File pcre2-CVE-2022-41409.patch of Package pcre2.29905
From 94e1c001761373b7d9450768aa15d04c25547a35 Mon Sep 17 00:00:00 2001
From: Philip Hazel <Philip.Hazel@gmail.com>
Date: Tue, 16 Aug 2022 17:00:45 +0100
Subject: [PATCH] Diagnose negative repeat value in pcre2test subject line
---
ChangeLog | 3 +++
src/pcre2test.c | 4 ++--
testdata/testinput2 | 3 +++
testdata/testoutput2 | 4 ++++
4 files changed, 12 insertions(+), 2 deletions(-)
Index: pcre2-10.31/ChangeLog
===================================================================
--- pcre2-10.31.orig/ChangeLog
+++ pcre2-10.31/ChangeLog
@@ -1,6 +1,13 @@
Change Log for PCRE2
--------------------
+Version 10.41 06-December-2022
+------------------------------
+
+20. A negative repeat value in a pcre2test subject line was not being
+diagnosed, leading to infinite looping.
+
+
3. Fix minor typo bug in JIT compile when \X is used in a non-UTF string.
Index: pcre2-10.31/src/pcre2test.c
===================================================================
--- pcre2-10.31.orig/src/pcre2test.c
+++ pcre2-10.31/src/pcre2test.c
@@ -6408,9 +6408,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;
}
Index: pcre2-10.31/testdata/testinput2
===================================================================
--- pcre2-10.31.orig/testdata/testinput2
+++ pcre2-10.31/testdata/testinput2
@@ -5429,4 +5429,7 @@ a)"xI
/(?=a+)a(a+)++b/B
+--
+ \[X]{-10}
+
# End of testinput2
Index: pcre2-10.31/testdata/testoutput2
===================================================================
--- pcre2-10.31.orig/testdata/testoutput2
+++ pcre2-10.31/testdata/testoutput2
@@ -16575,6 +16575,10 @@ No match
End
------------------------------------------------------------------
+--
+ \[X]{-10}
+** Zero or negative repeat not allowed
+
# End of testinput2
Error -65: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data