On 05/04/2017 03:09 PM, Martin Sebor wrote:
On 05/04/2017 01:17 PM, Jeff Law wrote:
On 01/25/2017 02:12 PM, Martin Sebor wrote:
While putting together examples for the GCC 7 changes document
I noticed that a few of the buffer overflow warnings issued by
-Wstringop-overflow are defeated by Glibc's macros for string
manipulation functions like strncat and strncpy.
While testing my fix I also noticed that I had missed a couple
of functions when implementing the warning: memmove and stpcpy.
The attached patch adds handlers for those and fixes the three
bugs below I raised for these omissions.
Is this patch okay for trunk?
PR preprocessor/79214 - -Wno-system-header defeats strncat buffer
overflow warnings
PR middle-end/79222 - missing -Wstringop-overflow= on a stpcpy overflow
PR middle-end/79223 - missing -Wstringop-overflow on a memmove overflow
Martin
gcc-79214.diff
PR preprocessor/79214 - -Wno-system-header defeats strncat buffer
overflow warnings
PR middle-end/79222 - missing -Wstringop-overflow= on a stpcpy overflow
PR middle-end/79223 - missing -Wstringop-overflow on a memmove overflow
gcc/ChangeLog:
PR preprocessor/79214
PR middle-end/79222
PR middle-end/79223
* builtins.c (check_sizes): Add inlinining context and issue
s/inlinining/inlining/
warnings even when -Wno-system-headers is set.
(check_strncat_sizes): Same.
(expand_builtin_strncat): Same.
(expand_builtin_memmove): New function.
(expand_builtin_stpncpy): Same.
(expand_builtin): Handle memmove and stpncpy.
gcc/testsuite/ChangeLog:
PR preprocessor/79214
PR middle-end/79222
PR middle-end/79223
* gcc.dg/pr79214.c: New test.
* gcc.dg/pr79214.h: New test header.
* gcc.dg/pr79222.c: New test.
* gcc.dg/pr79223.c: New test.
* gcc.dg/pr78138.c: Adjust.
OK with the ChangeLog nit fixed.
Done. Are bugs of this type candidates for backporting to release
branches?
Generally not since they are not regressions. They could also cause
cause false positives warnings which in turn could cause code that was
previously building OK to no longer build.
You can try to make a case to Jakub, Joseph & Richi for an exception
though. It's ultimately their call for a non-regression fix.
jeff