[Boost-bugs] [Boost C++ Libraries] #12960: Line break \R in x-mode

Subject: [Boost-bugs] [Boost C++ Libraries] #12960: Line break \R in x-mode
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-04-10 01:10:57


#12960: Line break \R in x-mode
------------------------------+-------------------------
 Reporter: robic0@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: regex
  Version: Boost 1.61.0 | Severity: Problem
 Keywords: line-break |
------------------------------+-------------------------
 Bug: get_escape_R_string()

 This function injects whitespace literals in the return string.[[BR]]
 This is a problem in x-mode since the whitespace[[BR]]
 is ignored when it's re-parsed, which then throws an exception.


 --------------------------------
 File: boost\regex\v4\regex_traits_defaults.hpp

 Function: get_escape_R_string()


 {{{
 template <class charT>
 inline const charT* get_escape_R_string()
 {
 #ifdef BOOST_MSVC
 # pragma warning(push)
 # pragma warning(disable:4309 4245)
 #endif

    static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?',
       '|', '[', '\x0A', '\x0B', '\x0C', static_cast<unsigned
 char>('\x85'), '\\', 'x', '{', '2', '0', '2', '8', '}',
                 '\\', 'x', '{', '2', '0', '2', '9', '}', ']', ')', '\0' };
    static const charT e2[] = { '(', '?', '>', '\x0D', '\x0A', '?',
       '|', '[', '\x0A', '\x0B', '\x0C', static_cast<unsigned
 char>('\x85'), ']', ')', '\0' };

    charT c = static_cast<charT>(0x2029u);
    bool b = (static_cast<unsigned>(c) == 0x2029u);

    return (b ? e1 : e2);
 #ifdef BOOST_MSVC
 # pragma warning(pop)
 #endif
 }

 }}}
 --------------------------------
 Can be fixed by converting the whitespace characters[[BR]]
 to hex string literal.


 {{{
    static const charT e1[] = { '(', '?', '>',
       '\\', 'x', '0', 'D', '\\', 'x', '0', 'A', '?',
       '|', '[',
       '\\', 'x', '0', 'A', '\\', 'x', '0', 'B', '\\', 'x', '0', 'C',
       '\\', 'x', '8', '5', '\\', 'x', '{', '2', '0', '2', '8', '}',
       '\\', 'x', '{', '2', '0', '2', '9', '}', ']', ')', '\0' };
    static const charT e2[] = { '(', '?', '>',
       '\\', 'x', '0', 'D', '\\', 'x', '0', 'A', '?',
       '|', '[',
       '\\', 'x', '0', 'A', '\\', 'x', '0', 'B', '\\', 'x', '0', 'C',
       '\\', 'x', '8', '5', ']', ')', '\0' };

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12960>
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-04-10 01:13:46 UTC