11 Star 0 Fork 33

src-openEuler/pcre2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-incorrect-patch-in-c1306126.patch 2.83 KB
一键复制 编辑 原始数据 按行查看 历史
From 7fe586b892c9e0cbf3b21d57cfd8135e2311e45c Mon Sep 17 00:00:00 2001
From: Philip Hazel <Philip.Hazel@gmail.com>
Date: Mon, 20 Nov 2023 15:41:06 +0000
Subject: [PATCH] Fix incorrect patch in c1306126
---
src/pcre2_compile.c | 20 ++++++++++++++------
testdata/testinput2 | 2 ++
testdata/testoutput2 | 2 ++
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index fdaf2ad..9e45580 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -2782,6 +2782,7 @@ uint32_t *previous_callout = NULL;
uint32_t *parsed_pattern = cb->parsed_pattern;
uint32_t *parsed_pattern_end = cb->parsed_pattern_end;
uint32_t *this_parsed_item = NULL;
+uint32_t *prev_parsed_item = NULL;
uint32_t meta_quantifier = 0;
uint32_t add_after_mark = 0;
uint32_t extra_options = cb->cx->extra_options;
@@ -2867,11 +2868,10 @@ while (ptr < ptrend)
uint32_t set, unset, *optset;
uint32_t terminator;
uint32_t prev_meta_quantifier;
- uint32_t *prev_parsed_item = this_parsed_item;
BOOL prev_okquantifier;
PCRE2_SPTR tempptr;
PCRE2_SIZE offset;
-
+
if (parsed_pattern >= parsed_pattern_end)
{
errorcode = ERR63; /* Internal error (parsed pattern overflow) */
@@ -2883,10 +2883,17 @@ while (ptr < ptrend)
errorcode = ERR19;
goto FAILED; /* Parentheses too deeply nested */
}
-
- /* Remember where this item started */
- this_parsed_item = parsed_pattern;
+ /* If the last time round this loop something was added, parsed_pattern will
+ no longer be equal to this_parsed_item. Remember where the previous item
+ started and reset for the next item. Note that sometimes round the loop,
+ nothing gets added (e.g. for ignored white space). */
+
+ if (this_parsed_item != parsed_pattern)
+ {
+ prev_parsed_item = this_parsed_item;
+ this_parsed_item = parsed_pattern;
+ }
/* Get next input character, save its position for callout handling. */
@@ -3440,7 +3447,8 @@ while (ptr < ptrend)
/* ---- Quantifier post-processing ---- */
- /* Check that a quantifier is allowed after the previous item. */
+ /* Check that a quantifier is allowed after the previous item. This
+ guarantees that there is a previous item. */
CHECK_QUANTIFIER:
if (!prev_okquantifier)
diff --git a/testdata/testinput2 b/testdata/testinput2
index ba292d8..da845c1 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -6051,4 +6051,6 @@ a)"xI
/abcd/
abcd\=ovector=65536
+/A +/extended
+
# End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 888f06a..85de4ae 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -17932,6 +17932,8 @@ No match
abcd\=ovector=65536
0: abcd
+/A +/extended
+
# End of testinput2
Error -70: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/pcre2.git
git@gitee.com:src-openeuler/pcre2.git
src-openeuler
pcre2
pcre2
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385