From 279a7d4ef749992d4d229b921ef1b9255882dc5c Mon Sep 17 00:00:00 2001 From: steven_q Date: Tue, 1 Aug 2023 15:05:01 +0800 Subject: [PATCH] fix CVE-2022-41409 Signed-off-by: steven_q Change-Id: I7173a0ee54914a80a9cd56798d9e7f0e6264ecf5 --- pcre2/src/pcre2test.c | 4 ++-- pcre2/testdata/testinput2 | 3 +++ pcre2/testdata/testoutput2 | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pcre2/src/pcre2test.c b/pcre2/src/pcre2test.c index ea52a20..378529a 100644 --- a/pcre2/src/pcre2test.c +++ b/pcre2/src/pcre2test.c @@ -6781,9 +6781,9 @@ while ((c = *p++) != 0) } i = (int32_t)li; - if (i-- == 0) + if (i-- <= 0) { - fprintf(outfile, "** Zero repeat not allowed\n"); + fprintf(outfile, "** Zero or negative repeat not allowed\n"); return PR_OK; } diff --git a/pcre2/testdata/testinput2 b/pcre2/testdata/testinput2 index d37d8f3..717ba2a 100644 --- a/pcre2/testdata/testinput2 +++ b/pcre2/testdata/testinput2 @@ -5932,4 +5932,7 @@ a)"xI /[Aa]{2,3}/BI aabcd +-- + \[X]{-10} + # End of testinput2 diff --git a/pcre2/testdata/testoutput2 b/pcre2/testdata/testoutput2 index ce090f8..d2188d3 100644 --- a/pcre2/testdata/testoutput2 +++ b/pcre2/testdata/testoutput2 @@ -17746,6 +17746,10 @@ Subject length lower bound = 2 aabcd 0: aa +-- + \[X]{-10} +** Zero or negative repeat not allowed + # End of testinput2 Error -70: PCRE2_ERROR_BADDATA (unknown error number) Error -62: bad serialized data -- Gitee