From 4f35ab78837e4d591760d061bc052ba1cb322ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=BF=97=E6=B6=9B?= Date: Mon, 19 Sep 2022 07:01:11 +0000 Subject: [PATCH 1/2] =?UTF-8?q?TEST(RE2,=20Bug18391750)=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=B7=B2=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘志涛 --- re2/testing/re2_test.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/re2/testing/re2_test.cc b/re2/testing/re2_test.cc index b4b57cc..b8e9a7e 100644 --- a/re2/testing/re2_test.cc +++ b/re2/testing/re2_test.cc @@ -1556,7 +1556,6 @@ TEST(RE2, Bug10131674) { EXPECT_FALSE(RE2::FullMatch("hello world", re)); } -/*待处理的 TEST(RE2, Bug18391750) { // Stray write past end of match_ in nfa.cc, caught by fuzzing + address sanitizer. const char t[] = { @@ -1576,7 +1575,6 @@ TEST(RE2, Bug18391750) { ASSERT_TRUE(re.ok()); RE2::PartialMatch(t, re); } -*/ TEST(RE2, Bug18458852) { // Bug in parser accepting invalid (too large) rune, -- Gitee From 88c925fe5a7976260e48d5c1609b9f2f5f1b7aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=BF=97=E6=B6=9B?= Date: Mon, 19 Sep 2022 07:02:31 +0000 Subject: [PATCH 2/2] =?UTF-8?q?TEST(RE2,=20Bug18391750)=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=B7=B2=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘志涛 --- re2/re2.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/re2/re2.cc b/re2/re2.cc index f17d772..1a60d09 100644 --- a/re2/re2.cc +++ b/re2/re2.cc @@ -199,7 +199,11 @@ namespace re2 uint32_t flags = RURE_DEFAULT_FLAGS; if(options_.dot_nl()) flags = RURE_FLAG_DOTNL; - if(options_.never_nl()) flags = RURE_DEFAULT_FLAGS; + // if(options_.never_nl()) flags = RURE_DEFAULT_FLAGS; + if(options_.encoding() == RE2::Options::EncodingLatin1){ + flags |= RURE_FLAG_UNICODE; + } + // for All rure *re = rure_compile((const uint8_t *)rure_str.c_str(), strlen(rure_str.c_str()), flags, NULL, err); //这里应该被注释,如果rure_str为空,re会为空,会去执行if(re == NULL)判断,从而对空的正则表达式进行处理 -- Gitee