This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 5/6] detect unterminated const arrays in stpcpy calls (PR 86552)


On 08/13/2018 03:28 PM, Martin Sebor wrote:
> The attached changes implement the detection of past-the-end reads
> by stpcpy due to unterminated arguments.
> 
> 
> gcc-86552-5.diff
> 
> 
> PR tree-optimization/86552 - missing warning for reading past the end of non-string arrays
> 
> gcc/ChangeLog:
> 
> 	* builtins.c (unterminated_array): Handle ARRAY_REF.
> 	(expand_builtin_stpcpy_1): Detect unterminated char arrays.
> 	* builtins.h (unterminated_array): Declare extern.
> 	* gimple-fold.c (gimple_fold_builtin_stpcpy): Detect unterminated
> 	  arrays.
> 	(gimple_fold_builtin_sprintf): Propagate NO_WARNING to transformed
> 	calls.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.dg/warn-stpcpy-no-nul.c: New test.
Same story and resolution as #2, #3 and #4.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]