14 Star 0 Fork 38

src-openEuler/pcre2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-incorrect-class-character-matches-in-JIT.patch 2.32 KB
一键复制 编辑 原始数据 按行查看 历史
xujing 提交于 2024-02-05 11:08 +08:00 . pcre2: sync patches from upstream
From 542cb11242cfc9be9b6218965751bfbb13a8b6a2 Mon Sep 17 00:00:00 2001
From: Zoltan Herczeg <hzmester@freemail.hu>
Date: Wed, 27 Dec 2023 08:27:17 +0000
Subject: [PATCH] Fix incorrect class character matches in JIT
---
src/pcre2_jit_compile.c | 8 ++++++++
src/pcre2_jit_test.c | 1 +
2 files changed, 9 insertions(+)
diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
index c8a51da..f612574 100644
--- a/src/pcre2_jit_compile.c
+++ b/src/pcre2_jit_compile.c
@@ -8170,6 +8170,7 @@ while (*cc != XCL_END)
jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
+ c = charoffset;
/* In case of ucp_Cf, we overwrite the result. */
SET_CHAR_OFFSET(0x2066);
OP2U(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
@@ -8181,6 +8182,9 @@ while (*cc != XCL_END)
OP2U(SLJIT_SUB | SLJIT_SET_Z, TMP1, 0, SLJIT_IMM, 0x180e - 0x2066);
OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ /* Restore charoffset. */
+ SET_CHAR_OFFSET(c);
+
JUMPHERE(jump);
jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
break;
@@ -8196,6 +8200,7 @@ while (*cc != XCL_END)
jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
+ c = charoffset;
/* In case of ucp_Cf, we overwrite the result. */
SET_CHAR_OFFSET(0x2066);
OP2U(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
@@ -8204,6 +8209,9 @@ while (*cc != XCL_END)
OP2U(SLJIT_SUB | SLJIT_SET_Z, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ /* Restore charoffset. */
+ SET_CHAR_OFFSET(c);
+
JUMPHERE(jump);
jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
break;
diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c
index e4dace8..f2c714b 100644
--- a/src/pcre2_jit_test.c
+++ b/src/pcre2_jit_test.c
@@ -417,6 +417,7 @@ static struct regression_test_case regression_test_cases[] = {
{ MUP, 0, 0, 0, "[\\p{Lu}\\P{Latin}]+", "c\xEA\xA4\xAE,A,b" },
{ MUP, 0, 0, 0, "[\\x{a92e}\\p{Lu}\\P{Latin}]+", "c\xEA\xA4\xAE,A,b" },
{ CMUP, 0, 0, 0, "[^S]\\B", "\xe2\x80\x8a" },
+ { MUP, 0, 0, 0 | F_NOMATCH, "[^[:print:]\\x{f6f6}]", "\xef\x9b\xb6" },
/* Possible empty brackets. */
{ MU, A, 0, 0, "(?:|ab||bc|a)+d", "abcxabcabd" },
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/pcre2.git
git@gitee.com:src-openeuler/pcre2.git
src-openeuler
pcre2
pcre2
master

搜索帮助