String: Improve overflow test coverage for strnlen
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
Commit Message
This patch adds more overflow test coverage for strnlen and wcsnlen.
---
string/test-strnlen.c | 2 ++
1 file changed, 2 insertions(+)
Comments
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.
@@ -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);