Opened 6 years ago

Last modified 6 years ago

#12624 new Bugs

bug error calling boost::make_u32regex()

Reported by: shane.quinlivan@… Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.63.0 Severity: Problem
Keywords: regex, solaris, bus error, SIGBUS Cc:

Description

os: SunOS 5.11 11.2 sun4v sparc sun4v gcc:gcc (GCC) 4.8.2 boost regex:tried 1.59->1_63+

When calling boost::make_u32regex() with a regex like: '302-Found
([0-9]+A[0-9]+
)'

The core occurs:

#0 0x00142854 in boost::re_detail_106300::basic_regex_creator<int, boost::icu_regex_traits>::append_set (this=0xffbfd5b0, char_set=...) at ./boost/regex/v4/basic_regex_creator.hpp:380 380 result->cclasses = char_set.classes();

I added some debug for char_set, and it was fine. The issue is with result ( boost::re_detail_106300::re_set_long<unsigned long long> *); this structure has 2 long long variables (8byte): cclasses, cnclasses after 3 * 4byte variables (csingles,cranges,cequivalents).

from boost/regex/v4/states.hpp, the structure is:

203 /* struct re_set_long * 204 A wide character set of characters, following this structure will be 205 an array of type charT: 206 First csingles null-terminated strings 207 Then 2 * cranges NULL terminated strings 208 Then cequivalents NULL terminated strings 209 */ 210 template <class mask_type> 211 struct re_set_long : public re_syntax_base 212 { 213 unsigned int csingles, cranges, cequivalents; 214 mask_type cclasses; 215 mask_type cnclasses; 216 bool isnot; 217 bool singleton; 218 };

When this struct definition is changed to force alignment:

203 /* struct re_set_long * 204 A wide character set of characters, following this structure will be 205 an array of type charT: 206 First csingles null-terminated strings 207 Then 2 * cranges NULL terminated strings 208 Then cequivalents NULL terminated strings 209 */ 210 template <class mask_type> 211 struct attribute((packed)) re_set_long : public re_syntax_base 212 { 213 unsigned int csingles, cranges, cequivalents; 214 mask_type cclasses; 215 mask_type cnclasses; 216 bool isnot; 217 bool singleton; 218 };

All our unit tests pass, and no core occurs.

This change also resolves the solaris issue mentioned here: http://lists.boost.org/boost-users/2010/03/57717.php

Change History (1)

comment:1 by John Maddock, 6 years ago

Apologies for getting to this late, can you please tell me, in regex_raw_buffer.hpp what is sizeof(padding) ? And more to the point does adding a boost::uint64_t to the body of struct padding also fix the issue?

Ultimately though, I need to fix this boost::alignof.

Note: See TracTickets for help on using tickets.