Hi,

When I was trying to use md5check.exe in R on Windows, I found that it is
actually crashed for R-2.7.2 and R-2.6.2 (R-2.5.1 seems to be ok).

As I looked into the code (src/gnuwin32/front-ends/md5check.c), I think that
there might be several bugs in the code:

(1) A "segmentation fault" occurred in read_unist_file("unins000.dat"). I
guess that the file pointer didn't stop when it reached EOF.

(2) For some reason, the lastest version of "snprintf" appended '\0' to the
string, so the following line:
       for(j = 0; j < 16; j++) snprintf (out+2*j, 2, "%02x", resblock[j]);
produced a (MD5) strings with '\0' at every even position.

(3) When there is no unins000.dat file, md5check.exe won't report any
missing files.

I think the last two "bugs" can be fixed by the following minor changes:

=============================

--- R-2.7.2/src/gnuwin32/front-ends/md5check.c  (revision 167)
+++ R-2.7.2/src/gnuwin32/front-ends/md5check.c  (working copy)
@@ -157,7 +157,7 @@
 #ifdef DEBUG
            printf("missing\n");
 #endif
-           if(found) {
+           if(found||nnames==0) {
                fprintf(stderr, "file %s: missing\n", line+34);
                miss++;
            }
@@ -171,7 +171,7 @@
 #endif
            continue;
        } else {
-           for(j = 0; j < 16; j++) snprintf (out+2*j, 2, "%02x",
resblock[j]);
+           for(j = 0; j < 16; j++) snprintf (out+2*j, 3, "%02x",
resblock[j]);
            out[32] = '\0';
            if(strcmp(onfile, out) == 0) {
 #ifdef DEBUG

=============================

I didn't fix the first one, because I am not familiar with the format of
unins000.dat.

Thanks,

Alex


###########################
Alex Chen, Ph.D.
REvolution Computing
1100 Dexter Ave. N, Suite 200
Tel: 206-577-4778
###########################

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to