https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101830

Bill Schmidt <wschmidt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #11 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Aha.  There is a coding bug in consume_whitespace () that *could* allow a
buffer overrun.

  while (pos < LINELEN && isspace(linebuf[pos]) && linebuf[pos] != '\n')
    pos++;

Subsequent reading of linebuf[pos] might read past the end of the buffer. 
There should be a guard afterwards if pos exceeds LINELEN - 1.

Fixing this does allow the code to compile with the current compiler.  So, I'm
sorry for the false report.

The warning message is still misleading, saying that there is definitely an
overrun, when there is only the possibility of one.  (We never encounter the
overrun on a rather large set of inputs.)  I'm not sure what can be done about
that.

I think the IL above that looks funky is probably just some sort of cut and
paste problem.  I didn't see the oddity in compiler dumps when I was trying to
find it.  So that's likely a red herring.

Thanks for having a look, Martin!

Reply via email to