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

Reply via email to