Compare commits

...

7 Commits

Author SHA1 Message Date
d8cc5dbbbe Remove CI runners that are no longer supported.
Adjust library paths.
2025-07-04 19:07:09 +01:00
60f5c1b958 Adjust build.jam to make regex header only.
While still installing the binary for those few that need it.
2025-07-04 17:58:12 +01:00
f851a08050 Merge pull request #246 from cmazakas/cve-42512790
fix integer overflow when parsing Perl-extended named backrefs
2025-03-04 19:27:22 +00:00
f0ae2d8f57 fix integer overflow when parsing Perl-extended named backrefs 2025-03-03 10:51:42 -08:00
34b1c2f615 Merge pull request #245 from cmazakas/cve-42506269
fix cve issue 42506269
2025-02-28 12:58:02 +00:00
187be72eb8 fix cve issue 42506269 2025-02-20 14:53:42 -08:00
0b64ecef6c Merge pull request #242 from boostorg/master-merge-2025-01-27
Master merge 2025 01 27
2025-01-28 09:27:11 +00:00
8 changed files with 103 additions and 104 deletions

View File

@ -10,6 +10,7 @@ on:
- master
- develop
- feature/**
- cve-*
pull_request:
release:
types: [published, created, edited]
@ -265,7 +266,7 @@ jobs:
run: ../../../b2 toolset=${{ matrix.toolset }} cxxstd=${{ matrix.standard }}
working-directory: ../boost-root/libs/regex/test
windows_gcc:
runs-on: windows-2019
runs-on: windows-latest
defaults:
run:
shell: cmd
@ -311,102 +312,8 @@ jobs:
- name: Test
run: ..\..\..\b2 --hash %ARGS%
working-directory: ../boost-root/libs/regex/test
windows_msvc_14_0:
runs-on: windows-2019
defaults:
run:
shell: cmd
env:
ARGS: toolset=${{ matrix.toolset }} address-model=64 cxxstd=${{ matrix.standard }}
strategy:
fail-fast: false
matrix:
toolset: [ msvc-14.0 ]
standard: [ 14, 17 ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[apple];[Apple];[APPLE];[linux];[Linux];[LINUX]'
commit-filter-separator: ';'
fail-fast: true
- name: Checkout main boost
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
- name: Update tools/boostdep
run: git submodule update --init tools/boostdep
working-directory: ../boost-root
- name: Copy files
run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\regex
working-directory: ../boost-root
- name: Install deps
run: python tools/boostdep/depinst/depinst.py -I example -g "--jobs 3" regex
working-directory: ../boost-root
- name: Bootstrap
run: bootstrap
working-directory: ../boost-root
- name: Generate headers
run: b2 headers
working-directory: ../boost-root
- name: Config info install
run: ..\..\..\b2 config_info_travis_install %ARGS%
working-directory: ../boost-root/libs/config/test
- name: Config info
run: config_info_travis
working-directory: ../boost-root/libs/config/test
- name: Test
run: ..\..\..\b2 --hash %ARGS%
working-directory: ../boost-root/libs/regex/test
windows_msvc_14_2:
runs-on: windows-2019
defaults:
run:
shell: cmd
env:
ARGS: toolset=${{ matrix.toolset }} address-model=64 cxxstd=${{ matrix.standard }}
strategy:
fail-fast: false
matrix:
toolset: [ msvc-14.2 ]
standard: [ 14, 17, latest ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[apple];[Apple];[APPLE];[linux];[Linux];[LINUX]'
commit-filter-separator: ';'
fail-fast: true
- name: Checkout main boost
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
- name: Update tools/boostdep
run: git submodule update --init tools/boostdep
working-directory: ../boost-root
- name: Copy files
run: xcopy /s /e /q %GITHUB_WORKSPACE% libs\regex
working-directory: ../boost-root
- name: Install deps
run: python tools/boostdep/depinst/depinst.py -I example -g "--jobs 3" regex
working-directory: ../boost-root
- name: Bootstrap
run: bootstrap
working-directory: ../boost-root
- name: Generate headers
run: b2 headers
working-directory: ../boost-root
- name: Config info install
run: ..\..\..\b2 config_info_travis_install %ARGS%
working-directory: ../boost-root/libs/config/test
- name: Config info
run: config_info_travis
working-directory: ../boost-root/libs/config/test
- name: Test
run: ..\..\..\b2 --hash %ARGS%
working-directory: ../boost-root/libs/regex/test
windows_msvc_14_3:
runs-on: windows-2022
runs-on: windows-2025
defaults:
run:
shell: cmd
@ -459,7 +366,7 @@ jobs:
run: msvc_test.bat
working-directory: ../boost-root/libs/regex/test/module
ubuntu-cmake-install:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
@ -491,7 +398,7 @@ jobs:
cmake --build .
cmake --build . --target check
ubuntu-cmake-check:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:

View File

@ -20,11 +20,12 @@ project /boost/regex
;
explicit
[ alias boost_regex : build//boost_regex ]
[ alias all : boost_regex example test ]
[ alias boost_regex : : : : <library>$(boost_dependencies) ]
[ alias boost_regex_old : build//boost_regex ]
[ alias all : boost_regex boost_regex_old example test ]
;
call-if : boost-library regex
: install boost_regex
: install boost_regex_old
;

View File

@ -5,7 +5,7 @@
project
: requirements
<library>/boost/regex//boost_regex
<library>/boost/regex//boost_regex_old
<library>/boost/timer//boost_timer
<threading>multi
<link>shared:<define>BOOST_REGEX_DYN_LINK=1

View File

@ -898,6 +898,11 @@ escape_type_class_jump:
}
const charT* pc = m_position;
std::intmax_t i = this->m_traits.toi(pc, m_end, 10);
if(i < 0 && !syn_end)
{
fail(regex_constants::error_backref, m_position - m_base);
return false;
}
if((i < 0) && syn_end)
{
// Check for a named capture, get the leftmost one if there is more than one:
@ -997,7 +1002,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
if((m_position != m_end)
&& (0 == (this->flags() & regbase::main_option_type))
&& (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_plus))
{
{
possessive = true;
++m_position;
}
@ -1114,6 +1119,13 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
else
contin = false;
break;
case regex_constants::syntax_hash:
if (this->flags() & regex_constants::mod_x) {
while((m_position != m_end) && !is_separator(*m_position++)){}
contin = true;
break;
}
BOOST_REGEX_FALLTHROUGH;
default:
contin = false;
}

View File

@ -19,6 +19,8 @@
#ifndef BOOST_REGEX_V5_REGBASE_HPP
#define BOOST_REGEX_V5_REGBASE_HPP
#include <boost/regex/config.hpp>
namespace boost{
//
// class regbase

View File

@ -5,7 +5,7 @@
project
: requirements
<library>/boost/regex//boost_regex
<library>/boost/regex//boost_regex_old
<library>/boost/detail//boost_detail
<threading>multi
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
@ -137,6 +137,8 @@ compile test_windows_defs_4.cpp ;
run issue153.cpp : : : "<toolset>msvc:<linkflags>-STACK:2097152" ;
run issue227.cpp ;
run issue232.cpp ;
run issue244.cpp ;
run issue245.cpp ;
run lookbehind_recursion_stress_test.cpp ;
run regex_replace_overflow.cpp ;

21
test/issue244.cpp Normal file
View File

@ -0,0 +1,21 @@
#include <boost/regex.hpp>
#include <string>
#include "test_macros.hpp"
int main()
{
char const strdata1[] = "\x00t\x03.z%(?x:]*+\x0c#\\x0c\x0c\x0c+\x0c#\\x0c\x0c\x0c\x11\x0c\x0c\xff\xff\xfd*\xff\xff\xff\xff\xff\xff\xff\xff|\xff\xff\xfd*\xff\xff)*\x01\x03\x00\x00\x00\x03\xff\xff\xff\x00\x00\xff\xff\xff";
char const strdata2[] = "(?x:]*+#comment\n+)*";
std::string str1(strdata1, strdata1 + sizeof(strdata1) - 1);
std::string str2(strdata2, strdata2 + sizeof(strdata2) - 1);
boost::match_results<std::string::const_iterator> what;
BOOST_TEST_THROWS((boost::regex(str1)), boost::regex_error);
BOOST_TEST_THROWS((boost::regex(str2)), boost::regex_error);
return boost::report_errors();
}

54
test/issue245.cpp Normal file
View File

@ -0,0 +1,54 @@
#include <boost/regex.hpp>
#include <vector>
#include <string>
#include "test_macros.hpp"
int main()
{
// invalid because \k-- is an unterminated token
{
char const strdata[] = "\\k--00000000000000000000000000000000000000000000000000000000009223372036854775807\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90";
std::string regex_string(strdata, strdata + sizeof(strdata) - 1);
BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error);
}
{
char const strdata[] = "\\k-00000000000000000000000000000000000000000000000000000000009223372036854775807\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90";
std::string regex_string(strdata, strdata + sizeof(strdata) - 1);
BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error);
}
{
char const strdata[] = "\\k00000000000000000000000000000000000000000000000000000000009223372036854775807\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90";
std::string regex_string(strdata, strdata + sizeof(strdata) - 1);
BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error);
}
{
char const strdata[] = "a(b*)c\\k{--1}d";
std::string regex_string(strdata, strdata + sizeof(strdata) - 1);
BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error);
}
{
char const strdata[] = "a(b*)c\\k-{-1}d";
std::string regex_string(strdata, strdata + sizeof(strdata) - 1);
BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error);
}
{
char const strdata[] = "\\k{--00000000000000000000000000000000000000000000000000000000009223372036854775807}\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90";
std::string regex_string(strdata, strdata + sizeof(strdata) - 1);
BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error);
}
{
char const strdata[] = "\\k{-00000000000000000000000000000000000000000000000000000000009223372036854775807}\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90";
std::string regex_string(strdata, strdata + sizeof(strdata) - 1);
BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error);
}
{
char const strdata[] = "\\k{00000000000000000000000000000000000000000000000000000000009223372036854775807}\xff\xff\xff\xff\xff\xff\xff\xef""99999999999999999999999999999999999]999999999999999\x90";
std::string regex_string(strdata, strdata + sizeof(strdata) - 1);
BOOST_TEST_THROWS((boost::regex(regex_string)), boost::regex_error);
}
return boost::report_errors();
}