From 1cef68c4b594cf959996f7e9e86314bad3e2b799 Mon Sep 17 00:00:00 2001 From: xuhuijie <546391727@qq.com> Date: Tue, 22 Jun 2021 10:32:48 +0800 Subject: [PATCH] regex: fix dead loop in parse_repeat() Signed-off-by: Xu Huijie xuhuijie2@huawei.com --- boost.spec | 11 +++++++- regex-fix-dead-loop-in-parse_repeat.patch | 33 +++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 regex-fix-dead-loop-in-parse_repeat.patch diff --git a/boost.spec b/boost.spec index 9fc9417..e96f19b 100644 --- a/boost.spec +++ b/boost.spec @@ -22,7 +22,7 @@ Name: boost Version: 1.73.0 -Release: 2 +Release: 3 Summary: The free peer-reviewed portable C++ source libraries License: Boost Software License V1.0 URL: http://www.boost.org @@ -44,6 +44,8 @@ Patch3: boost-1.58.0-pool-test_linking.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1318383 Patch4: boost-1.66.0-no-rpath.patch +Patch9000: regex-fix-dead-loop-in-parse_repeat.patch + Requires: %{name}-atomic%{?_isa} = %{version}-%{release} Requires: %{name}-chrono%{?_isa} = %{version}-%{release} Requires: %{name}-container%{?_isa} = %{version}-%{release} @@ -589,6 +591,7 @@ find ./boost -name '*.hpp' -perm /111 | xargs chmod a-x %patch2 -p0 %patch3 -p1 %patch4 -p1 +%patch9000 -p1 %build %if %{with python3} @@ -1135,6 +1138,12 @@ fi %{_mandir}/man1/bjam.1* %changelog +* Tue Jun 22 2021 Xu Huijie - 1.73.0-3 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix dead loop in parse_repeat() + * Wed Dec 16 2020 xinghe - 1.73.0-2 - correct license diff --git a/regex-fix-dead-loop-in-parse_repeat.patch b/regex-fix-dead-loop-in-parse_repeat.patch new file mode 100644 index 0000000..b0dc524 --- /dev/null +++ b/regex-fix-dead-loop-in-parse_repeat.patch @@ -0,0 +1,33 @@ +From 91107fe78a290a7d25a042fec09ea89f14f480d9 Mon Sep 17 00:00:00 2001 +From: xuhuijie +Date: Wed, 16 Jun 2021 15:47:22 +0800 +Subject: [PATCH] regex: fix dead loop in parse_repea + There is a bug in parse_repeat(), after deal with comment the + contin value will be always true. So we enter a dead loop. To deal with this, + we assign contin to false each time we enter the loop. + Testcase: boost::regex(std::string("1?+(?#)1")) + +Signed-off-by: Xu Huijie +--- + boost/regex/v4/basic_regex_parser.hpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/boost/regex/v4/basic_regex_parser.hpp b/boost/regex/v4/basic_regex_parser.hpp +index 6c7065f05..de22f7000 100644 +--- a/boost/regex/v4/basic_regex_parser.hpp ++++ b/boost/regex/v4/basic_regex_parser.hpp +@@ -1080,9 +1080,10 @@ bool basic_regex_parser::parse_repeat(std::size_t low, std::size_ + // Check for illegal following quantifier, we have to do this here, because + // the extra states we insert below circumvents our usual error checking :-( + // +- bool contin = false; ++ bool contin; + do + { ++ contin = false; + if ((this->flags() & (regbase::main_option_type | regbase::mod_x | regbase::no_perl_ex)) == regbase::mod_x) + { + // whitespace skip: +-- +2.23.0 + -- Gitee