[Bug middle-end/54582] gap in FORTIFY checking of buffer lengths
dcb314 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Feb 6 18:48:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54582
--- Comment #11 from David Binderman <dcb314 at hotmail dot com> 2013-02-06 18:47:37 UTC ---
>It isn't that easy. For %'s you really have to parse all the characters after
>% and figure out where the format specifier ends.
Agreed. But it doesn't have to be perfect, it just has to be
better than the previous solution. This is only a warning we are discussing.
It can be ignored.
The Werror folks are, IMHO, far too keen for their own good.
I wrote:
>All the numeric specifiers (%d, %u etc) all produce at least one
>character, so gcc could take account of this in checking buffer lengths.
In computing a lower bound, all % specifiers could be assumed to
produce at least one byte of output.
Parsing the % specifier doesn't have to be perfect, it just has
to understand the common cases (%s, %d, %u etc) and punt on the rest.
More understanding can be added in later versions.
More information about the Gcc-bugs
mailing list