Boost logo

Boost Users :

Subject: [Boost-users] Problem with boost regex and icu support.
From: Jason Pollock (jason.pollock_at_[hidden])
Date: 2010-03-24 21:57:37


Hello everyone, new boost user here. :)

I'm attempting to use the regular expression library with ICU support
and I'm running into a coredump inside of boost.

The following test program is dumping core depending on the regular
expression. Replacing the " " with a ".*" results in a crash. Can
anyone provide a hint about why?

Any tips that anyone could offer would be appreciated.

I've pasted both the test and the backtrace below, because I don't know
what the list rules are for attachments.

Thank you in advance,
Jason Pollock

===========================================================================

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

/*

test$ uname -a
SunOS ab8 5.9 Generic_118558-34 sun4u sparc SUNW,Sun-Fire-V240

test$ gcc --version
gcc (GCC) 3.2.3
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Boost Version: 1.42.0
ICU Version: ICU 4c - 4.2.1

test$ ./boost_sample "^QUERY.*[0-9][0-9]*"
test$ ./boost_sample "^QUERY [0-9][0-9]*"
Bus Error (core dumped)

*/

int main(int argc, char **argv)
{
    std::string line;
    int flags = boost::regex_constants::extended;

    try {
        UnicodeString uPattern = UnicodeString::fromUTF8(argv[1]);
        const boost::u32regex pat = boost::make_u32regex(uPattern, flags);
    } catch (std::exception &e) {
        std::cerr << "Exception raised: " << e.what() << std::endl;
    }
    return 0;
}

==============================================================================

#0 0x0005d5f0 in boost::re_detail::basic_regex_creator<int,
boost::icu_regex_traits>::append_set ()
#1 0x00054adc in boost::re_detail::basic_regex_parser<int,
boost::icu_regex_traits>::parse_set ()
#2 0x0004cb54 in boost::re_detail::basic_regex_parser<int,
boost::icu_regex_traits>::parse_extended ()
#3 0x00049a00 in boost::re_detail::basic_regex_parser<int,
boost::icu_regex_traits>::parse ()
#4 0x00046d74 in boost::basic_regex<int,
boost::icu_regex_traits>::do_assign ()
#5 0x000446c0 in boost::basic_regex<int,
boost::icu_regex_traits>::assign (this=0xffbff770, p1=0x10aa828,
p2=0x10aa870, f=2163456) at include/boost/regex/v4/basic_regex.hpp:425
#6 0x0004465c in boost::basic_regex<int,
boost::icu_regex_traits>::assign<int*> (this=0xffbff770,
arg_first=0xffbff558, arg_last=0x10aa828, f=2163456)
    at include/boost/regex/v4/basic_regex.hpp:477
#7 0x00044424 in boost::basic_regex<int,
boost::icu_regex_traits>::basic_regex<boost::u16_to_u32_iterator<unsigned
short const*, int> > (this=0xffbff770, arg_first=
      {<iterator_facade<boost::u16_to_u32_iterator<const short unsigned
int*, int>,int,std::bidirectional_iterator_tag,const int,int>> = {<No
data fields>}, static pending_read = <optimized out>, m_position = 0x5e,
m_value = 81}, arg_last=
      {<iterator_facade<boost::u16_to_u32_iterator<const short unsigned
int*, int>,int,std::bidirectional_iterator_tag,const int,int>> = {<No
data fields>}, static pending_read = <optimized out>, m_position =
0x10aa7d0, m_value = -1}, f=2163456)
    at include/boost/regex/v4/basic_regex.hpp:447
#8 0x000442d0 in boost::re_detail::do_make_u32regex<unsigned short
const*> (i=0x10aa7e0, j=0x10aa7d0, opt=2163456) at
include/boost/regex/icu.hpp:260
#9 0x00044214 in boost::make_u32regex (s=@0xffbff778, opt=2163456) at
include/boost/regex/icu.hpp:381
#10 0x00044014 in main (argc=-4196488, argv=0xffbff81c) at
boost_sample.cc:33


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net