Opened 11 years ago

Closed 11 years ago

#6440 closed Bugs (fixed)

Regex crash in object_cache in many-locale mulithreaded scenarios

Reported by: Hamid Palo <hamid.palo@…> Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.48.0 Severity: Showstopper
Keywords: Cc:

Description

An intermittent crash occurs in object_cache when using regex in apps with many locales in multithreaded apps. The crash occurs due to pos not being decrementable in object_cache.hpp line 154 in boost 1.48.0.

Stack:

msvcr90!_invalid_parameter_noinfo+0xc
myapp!boost::object_cache<unsigned long,boost::re_detail::w32_regex_traits_implementation<wchar_t> >::do_get+0x533
myapp!boost::object_cache<unsigned long,boost::re_detail::w32_regex_traits_implementation<wchar_t> >::get+0x69
myapp!boost::re_detail::create_w32_regex_traits<wchar_t>+0x1b
myapp!boost::re_detail::regex_data<wchar_t,boost::regex_traits<wchar_t,boost::w32_regex_traits<wchar_t> > >::regex_data<wchar_t,boost::regex_traits<wchar_t,boost::w32_regex_traits<wchar_t> > >+0x6c
myapp!boost::basic_regex<wchar_t,boost::regex_traits<wchar_t,boost::w32_regex_traits<wchar_t> > >::do_assign+0x5f
myapp!boost::basic_regex<wchar_t,boost::regex_traits<wchar_t,boost::w32_regex_traits<wchar_t> > >::assign+0x23
myapp!match+0x131

The attached program reproes this consistently in anywhere from 1 min to 10 min on my Xeon workstation running Win7 x64 and using msvc version 16.00.40219.01. I have not tried any other compilers yet.

The attached code also does not call regex directly but rather it manipulates object_cache directly in the same way that w32_regex_traits does in order to get an easier repro.

Attachments (1)

boostcrash.cpp (1.1 KB ) - added by Hamid Palo <hamid.palo@…> 11 years ago.
Reproduction program.

Download all attachments as: .zip

Change History (2)

by Hamid Palo <hamid.palo@…>, 11 years ago

Attachment: boostcrash.cpp added

Reproduction program.

comment:1 by John Maddock, 11 years ago

Resolution: fixed
Status: newclosed

(In [76775]) Fix bug in object_cache.hpp Fixes #6440.

Note: See TracTickets for help on using tickets.