about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2021-06-23 19:17:29 -0400
committerNoah Goldstein <goldstein.w.n@gmail.com>2021-06-24 19:14:15 -0400
commitbd3a2b3ed18fdeff0b370110c35850b51d025e8c (patch)
treeb51b2e0cae9838cbf186f4f14072257c9788d070
parent9f70985569888d68612012fcb538c47c154c1e8b (diff)
downloadglibc-bd3a2b3ed18fdeff0b370110c35850b51d025e8c.tar.gz
glibc-bd3a2b3ed18fdeff0b370110c35850b51d025e8c.tar.xz
glibc-bd3a2b3ed18fdeff0b370110c35850b51d025e8c.zip
String: Add three more overflow tests cases to test-strnlen.c
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>
-rw-r--r--string/test-strnlen.c4
1 files changed, 4 insertions, 0 deletions
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);
         }
     }
 }