]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
String: Add three more overflow tests cases to test-strnlen.c
authorNoah Goldstein <goldstein.w.n@gmail.com>
Wed, 23 Jun 2021 23:17:29 +0000 (19:17 -0400)
committerNoah Goldstein <goldstein.w.n@gmail.com>
Thu, 24 Jun 2021 23:14:15 +0000 (19:14 -0400)
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>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
string/test-strnlen.c

index f53e09263f785d98925d690355dbda6d7de0f97e..bb5d9b5f04fa6586b2194226fa39f4a212851a20 100644 (file)
@@ -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);
         }
     }
 }