Ben Wing wrote:
i'm using 1.3.2.
i still wonder though whether i'm not seeing a sscanf bug, as i get a crash on a
line with sscanf in it, and my char * pointer is getting corrupted [set to a
small number] -- and it occurs on the stack, directly above the last variable
that sscanf is supposed to be writing into.
Well, we fixed *one* sscanf bug. As a friend of mine says, behind every
big bug are thousands of little bugs struggling to be noticed.
here's the code:
char *p = line;
int cp1, cp2, endcount;
int cp1high, cp1low;
int dummy;
while (*p) /* erase all comments out of the line */
{
if (*p == '#')
*p = '\0';
else
p++;
}
/* see if line is nothing but whitespace and skip if so */
p = line + strspn (line, " \t\n\r\f");
if (!*p)
continue;
if ((!ignore_first_column ? <-------------------------------------
sscanf (p, "%i %i %n", &cp1, &cp2, &endcount) < 2 :
sscanf (p, "%i %i %i %n", &dummy, &cp1, &cp2, &endcount)
< 3)
|| *(line + endcount))
{
warn_when_safe (intern ("unicode"), Qnotice,
"Unrecognized line in translation file %s:\n%s",
XSTRING_DATA (filename), line);
continue;
}
if (cp1 >= st && cp1 <= en)
GDB reports the crash on the line indicated, and reports p as 0x24 <address out
of bounds>.
are you in contact with cygwin people?
Yes, but actually cygwin gets its sscanf() function from newlib, so
patches/discussion/etc should go to the newlib mailing list.
I can't see anything obviously wrong with *your* code; you may need to
build a debug version of the cygwin1.dll to track this down, if it is in
fact inside sscanf().
--Chuck