[PATCH v1 1/2] String: Add three more overflow tests cases to test-strnlen.c

H.J. Lu hjl.tools@gmail.com
Thu Jun 24 00:41:08 GMT 2021


On Wed, Jun 23, 2021 at 4:59 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>
> No bug. Just seem like relevant cases given that strnlen will
> use s + maxlen in many implementations.
>
> Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
> ---
>  string/test-strnlen.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/string/test-strnlen.c b/string/test-strnlen.c
> index f53e09263f..bb5d9b5f04 100644
> --- a/string/test-strnlen.c
> +++ b/string/test-strnlen.c
> @@ -117,6 +117,10 @@ do_overflow_tests (void)
>            do_test (0, i, ~len + i, BIG_CHAR);
>            do_test (0, i, ~len - buf_addr - i, BIG_CHAR);
>            do_test (0, i, ~len - buf_addr + i, BIG_CHAR);
> +
> +          do_test (0, i, -buf_addr, BIG_CHAR);
> +          do_test (0, i, j - buf_addr, BIG_CHAR);
> +          do_test (0, i, -buf_addr - j, BIG_CHAR);
>          }
>      }
>  }
> --
> 2.25.1
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Thanks.

-- 
H.J.


More information about the Libc-alpha mailing list