[Boost-bugs] [Boost C++ Libraries] #6886: Bugs in boost/regex/icu.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #6886: Bugs in boost/regex/icu.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-05-10 08:54:52


#6886: Bugs in boost/regex/icu.hpp
---------------------------------------------------+------------------------
 Reporter: Martin Baute <solar@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: regex
  Version: Boost 1.49.0 | Severity: Problem
 Keywords: |
---------------------------------------------------+------------------------
 I am 100% sure I already reported these a couple of years
 ago (when 1.45 was current), but I just realized they haven't
 been fixed yet.

 In boost/regex/icu.hpp:

 Line 238 has a preprocessor #if that does special handling
 if BOOST_NO_MEMBER_TEMPLATES or __IBMCPP__ is defined. That's
 why the buggy code doesn't show itself on "average" machines.
 However, when trying to compile Boost.regex with ICU support
 on an AIX machine, compilation fails due to two bugs in the
 #else part of the code.

 The first bug is in line 314:

     typedef std::vector<UCHAR32> vector_type;

 The type is UChar32, not UCHAR32. The two templates before
 this one got it right, this template got it wrong.

 The second bug is in line 318:

     v.push_back((UCHAR32)(*i));

 Same as above - should be UChar32.

 The third bug is a classic copy&paste error. In line 319:

     ++a;

 If you look at the surrounding code, there is no "a" defined
 here. The two previous templates define a 32-bit integer "a"
 by type-converting the "i" parameter (which is 8-bit in the
 first template and 16-bit in the second one), but in this
 third template "i" is 32-bit itself already, so there is no
 need to convert it. You see the surrounding "while" loop and
 the push_back() call using "i" directly, and the increment
 should do the same.

 The patch:

 314c314
 < typedef std::vector<UCHAR32> vector_type;
 ---

     typedef std::vector<UChar32> vector_type;

 318,319c318,319
 < v.push_back((UCHAR32)(*i));
 < ++a;
 ---

     v.push_back((UChar32)(*i)); ++i;


 CVS Web link for ease of reference:

 http://boost.cvs.sourceforge.net/viewvc/boost/boost/boost/regex/icu.hpp?view=markup

 It would be nice if someone could commit this patch, because
 this bug has been around since v1.33...

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6886>
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:09 UTC