Opened 6 years ago

Closed 6 years ago

#12222 closed Bugs (fixed)

Segmentation fault in boost::make_u32regex when trying to construct invalid regular expression

Reported by: electricityispower@… Owned by: John Maddock
Milestone: Boost 1.62.0 Component: regex
Version: Boost 1.61.0 Severity: Regression
Keywords: Cc:

Description

The following code produces segmentation fault with boost 1.61.0, icu 57.1:

#include <boost/regex/icu.hpp>
#include <iostream>

int main()
{
	auto rx = boost::make_u32regex("\\", boost::regex::basic);
	std::cout << boost::u32regex_search("qwerty", rx) << std::endl;
}

Backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b54b7b in boost::re_detail_106100::basic_regex_parser<int, boost::icu_regex_traits>::parse_basic()
 () from /usr/lib64/libboost_regex.so.1.61.0                                                                 
(gdb) bt
#0  0x00007ffff7b54b7b in boost::re_detail_106100::basic_regex_parser<int, boost::icu_regex_traits>::parse_bas
ic() () from /usr/lib64/libboost_regex.so.1.61.0                                                             
#1  0x00007ffff7b565a6 in boost::re_detail_106100::basic_regex_parser<int, boost::icu_regex_traits>::parse(int
 const*, int const*, unsigned int) () from /usr/lib64/libboost_regex.so.1.61.0                               
#2  0x00007ffff7b56a1d in boost::basic_regex<int, boost::icu_regex_traits>::do_assign(int const*, int const*, 
unsigned int) () from /usr/lib64/libboost_regex.so.1.61.0                                                    
#3  0x0000000000406fa4 in boost::basic_regex<int, boost::icu_regex_traits>::assign(int const*, int const*, uns
igned int) ()                                                                                                
#4  0x000000000040631d in boost::basic_regex<int, boost::icu_regex_traits>::basic_regex<boost::u8_to_u32_itera
tor<char const*, int> >(boost::u8_to_u32_iterator<char const*, int>, boost::u8_to_u32_iterator<char const*, in
t>, unsigned int) ()                                                                                         
#5  0x00000000004057ba in boost::basic_regex<int, boost::icu_regex_traits> boost::re_detail_106100::do_make_u3
2regex<char const*>(char const*, char const*, unsigned int, mpl_::int_<1> const*) ()                         
#6  0x00000000004050d5 in boost::make_u32regex(char const*, unsigned int) ()
#7  0x0000000000404604 in main ()

Change History (1)

comment:1 by John Maddock, 6 years ago

Milestone: To Be DeterminedBoost 1.62.0
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.