This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 6/6] detect unterminated const arrays in strnlen calls (PR 86552)
- From: Jeff Law <law at redhat dot com>
- To: Martin Sebor <msebor at gmail dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 30 Aug 2018 17:25:22 -0600
- Subject: Re: [PATCH 6/6] detect unterminated const arrays in strnlen calls (PR 86552)
- References: <a0d277c4-41c5-61a8-0284-5b1b245e2c74@gmail.com> <ff946355-efec-e286-d7b7-1505a8acc55b@gmail.com> <fcafd5f3-b8fa-faa3-29f4-41fab9d927c8@gmail.com> <90953771-af77-b1a6-2215-fc48a07cebd6@gmail.com>
On 08/13/2018 03:29 PM, Martin Sebor wrote:
> The attached changes implement the detection of past-the-end reads
> by strncpy due to unterminated arguments and excessive bounds.
>
>
> gcc-86552-6.diff
>
>
> PR tree-optimization/86552 - missing warning for reading past the end of non-string arrays
>
> gcc/ChangeLog:
> * builtins.c (expand_builtin_strnlen): Detect, avoid expanding,
> and diagnose unterminated arrays.
>
> gcc/testsuite/ChangeLog:
> * gcc.dg/warn-strnlen-no-nul.c: New.
This will have the same state and resolution as #2-#5.
jeff