tag 386176 patch
thanks
#386176 - binutils: gprof --file-ordering /dev/null segfaults
http://bugs.debian.org./386176
--- corefile.c.orig 2008-02-25 18:36:11.000000000 -0500
+++ corefile.c 2008-02-25 19:10:19.000000000 -0500
@@ -82,7 +82,7 @@
int matches;
matches = fscanf (file, "%[^\n:]", dummy);
- if (!matches)
+ if (matches<=0)
parse_error (filename);
/* Just skip messages about files with no symbols. */
@@ -96,7 +96,7 @@
/* Don't care what else is on this line at this point. */
matches = fscanf (file, "%[^\n]\n", dummy);
- if (!matches)
+ if (matches<=0)
parse_error (filename);
count++;
}
@@ -106,7 +106,8 @@
xmalloc (count * sizeof (struct function_map)));
/* Rewind the input file so we can read it again. */
- rewind (file);
+ if (-1==fseek(file, 0, SEEK_SET))
+ parse_error (filename);
/* Read each entry and put it into the table. */
count = 0;
@@ -116,7 +117,7 @@
char *tmp;
matches = fscanf (file, "%[^\n:]", dummy);
- if (!matches)
+ if (matches<=0)
parse_error (filename);
/* Just skip messages about files with no symbols. */
@@ -134,9 +135,11 @@
/* Now we need the function name. */
matches = fscanf (file, "%[^\n]\n", dummy);
- if (!matches)
+ if (matches<=0)
parse_error (filename);
tmp = strrchr (dummy, ' ') + 1;
+ if (tmp==NULL)
+ parse_error (filename);
symbol_map[count].function_name = xmalloc (strlen (tmp) + 1);
strcpy (symbol_map[count].function_name, tmp);
count++;
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]