diff mbox series

String: Improve overflow test coverage for strnlen

Message ID 20220525210231.2023728-1-skpgkp2@gmail.com
State New
Headers show
Series String: Improve overflow test coverage for strnlen | expand

Commit Message

Sunil Pandey May 25, 2022, 9:02 p.m. UTC
This patch adds more overflow test coverage for strnlen and wcsnlen.
---
 string/test-strnlen.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

H.J. Lu May 25, 2022, 9:05 p.m. UTC | #1
On Wed, May 25, 2022 at 2:02 PM Sunil K Pandey <skpgkp2@gmail.com> wrote:
>
> This patch adds more overflow test coverage for strnlen and wcsnlen.
> ---
>  string/test-strnlen.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/string/test-strnlen.c b/string/test-strnlen.c
> index 83c4502b9a..4a9375112a 100644
> --- a/string/test-strnlen.c
> +++ b/string/test-strnlen.c
> @@ -96,6 +96,8 @@ do_overflow_tests (void)
>
>    for (i = 0; i < 750; ++i)
>      {
> +      do_test (1, i, SIZE_MAX, BIG_CHAR);
> +
>        do_test (0, i, SIZE_MAX - i, BIG_CHAR);
>        do_test (0, i, i - buf_addr, BIG_CHAR);
>        do_test (0, i, -buf_addr - i, BIG_CHAR);
> --
> 2.35.3
>

LGTM.

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

Thanks.
diff mbox series

Patch

diff --git a/string/test-strnlen.c b/string/test-strnlen.c
index 83c4502b9a..4a9375112a 100644
--- a/string/test-strnlen.c
+++ b/string/test-strnlen.c
@@ -96,6 +96,8 @@  do_overflow_tests (void)
 
   for (i = 0; i < 750; ++i)
     {
+      do_test (1, i, SIZE_MAX, BIG_CHAR);
+
       do_test (0, i, SIZE_MAX - i, BIG_CHAR);
       do_test (0, i, i - buf_addr, BIG_CHAR);
       do_test (0, i, -buf_addr - i, BIG_CHAR);