[Boost-bugs] [Boost C++ Libraries] #12624: bug error calling boost::make_u32regex()

Subject: [Boost-bugs] [Boost C++ Libraries] #12624: bug error calling boost::make_u32regex()
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-11-25 05:22:18


#12624: bug error calling boost::make_u32regex()
---------------------------------------------+-------------------------
 Reporter: shane.quinlivan@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: regex
  Version: Boost 1.63.0 | Severity: Problem
 Keywords: regex,solaris,bus error, SIGBUS |
---------------------------------------------+-------------------------
 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

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12624>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC