pcre2/backport-CVE-2022-1586-1.patch
2022-05-28 17:10:46 +08:00

54 lines
2.0 KiB
Diff

From 50a51cb7e67268e6ad417eb07c9de9bfea5cc55a Mon Sep 17 00:00:00 2001
From: Zoltan Herczeg <hzmester@freemail.hu>
Date: Wed, 23 Mar 2022 07:53:25 +0000
Subject: [PATCH] Fixed a unicode properrty matching issue in JIT
---
ChangeLog | 3 +++
src/pcre2_jit_compile.c | 2 +-
src/pcre2_jit_test.c | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 310eb60..efba64b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -123,6 +123,9 @@ configurations. Patch by Carlo Marcelo Arenas Belon.
30. Restrict the configuration setting for the SELinux compatible execmem
allocator (change 10.30/44) to Linux and NetBSD.
+23. Fixed a unicode properrty matching issue in JIT. The character was not
+fully read in caseless matching.
+
Version 10.34 21-November-2019
------------------------------
diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
index 2057f00..bcaf107 100644
--- a/src/pcre2_jit_compile.c
+++ b/src/pcre2_jit_compile.c
@@ -7400,7 +7400,7 @@ while (*cc != XCL_END)
{
SLJIT_ASSERT(*cc == XCL_PROP || *cc == XCL_NOTPROP);
cc++;
- if (*cc == PT_CLIST)
+ if (*cc == PT_CLIST && *cc == XCL_PROP)
{
other_cases = PRIV(ucd_caseless_sets) + cc[1];
while (*other_cases != NOTACHAR)
diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c
index b7856ad..eefcb8d 100644
--- a/src/pcre2_jit_test.c
+++ b/src/pcre2_jit_test.c
@@ -409,6 +409,7 @@ static struct regression_test_case regression_test_cases[] = {
{ MUP, A, 0, 0 | F_PROPERTY, "[\xc3\xa2-\xc3\xa6\xc3\x81-\xc3\x84\xe2\x80\xa8-\xe2\x80\xa9\xe6\x92\xad\\p{Zs}]{2,}", "\xe2\x80\xa7\xe2\x80\xa9\xe6\x92\xad \xe6\x92\xae" },
{ MUP, A, 0, 0 | F_PROPERTY, "[\\P{L&}]{2}[^\xc2\x85-\xc2\x89\\p{Ll}\\p{Lu}]{2}", "\xc3\xa9\xe6\x92\xad.a\xe6\x92\xad|\xc2\x8a#" },
{ PCRE2_UCP, 0, 0, 0 | F_PROPERTY, "[a-b\\s]{2,5}[^a]", "AB baaa" },
+ { CMUP, 0, 0, 0, "[^S]\\B", "\xe2\x80\x8a" },
/* Possible empty brackets. */
{ MU, A, 0, 0, "(?:|ab||bc|a)+d", "abcxabcabd" },
--
2.27.0