pcre2/backport-Fixed-a-word-boundary-check-bug-in-JIT-when-partial-.patch
yangmingtaip cf22193e63 sync community patchs
(cherry picked from commit 157b747b849cd84364a10b496c4338d7faa7f49a)
2022-10-18 21:00:07 +08:00

62 lines
1.6 KiB
Diff

From 2451870e3c47a849d729ed83dce4d7434460f49b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Herczeg?= <hzmester@freemail.hu>
Date: Tue, 27 Oct 2020 08:16:04 +0000
Subject: [PATCH] Fixed a word boundary check bug in JIT when partial matching
is enabled.
Conflict:delete Changelog
Reference:https://github.com/PhilipHazel/pcre2/commit/2451870e3c47a849d729ed83dce4d7434460f49b
---
src/pcre2_jit_compile.c | 2 ++
testdata/testinput10 | 4 ++++
testdata/testoutput10 | 6 ++++++
3 files changed, 12 insertions(+)
diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
index 03726b8..3d699a0 100644
--- a/src/pcre2_jit_compile.c
+++ b/src/pcre2_jit_compile.c
@@ -6571,9 +6571,11 @@ if (common->invalid_utf)
if (common->mode != PCRE2_JIT_COMPLETE)
{
+ OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0);
OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0);
move_back(common, NULL, TRUE);
check_start_used_ptr(common);
+ OP1(SLJIT_MOV, TMP1, 0, RETURN_ADDR, 0);
OP1(SLJIT_MOV, STR_PTR, 0, TMP2, 0);
}
}
diff --git a/testdata/testinput10 b/testdata/testinput10
index efd3298..53e37cb 100644
--- a/testdata/testinput10
+++ b/testdata/testinput10
@@ -613,4 +613,8 @@
/A/utf,match_invalid_utf,caseless
\xe5A
+/\bch\b/utf,match_invalid_utf
+ qchq\=ph
+ qchq\=ps
+
# End of testinput10
diff --git a/testdata/testoutput10 b/testdata/testoutput10
index 2a3803f..d408510 100644
--- a/testdata/testoutput10
+++ b/testdata/testoutput10
@@ -1875,4 +1875,10 @@ Subject length lower bound = 1
\xe5A
0: A
+/\bch\b/utf,match_invalid_utf
+ qchq\=ph
+Partial match:
+ qchq\=ps
+Partial match:
+
# End of testinput10
--
2.27.0