Opened 7 years ago

Closed 7 years ago

#11988 closed Bugs (fixed)

Variable length hexadecimal escape always fails in basic_regex_parser

Reported by: wbond <will@…> Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.60.0 Severity: Problem
Keywords: Cc:

Description

Using a variable length hexadecimal escape \x{41} causes the error Hexadecimal escape sequence was invalid.

This appears to be caused by the int cast at https://github.com/boostorg/regex/blob/aa6495ae486522456bb0d507cd93f8023c3c4c0c/include/boost/regex/v4/basic_regex_parser.hpp#L1759.

Change History (2)

comment:1 by wbond <will@…>, 7 years ago

Specifically, this occurs with the type boost::basic_regex<uint32_t>, which explains why (std::numeric_limits<charT>::max)() it overflows int.

comment:2 by John Maddock, 7 years ago

Resolution: fixed
Status: newclosed

I believe this is now fixed in:

https://github.com/boostorg/regex/commit/955d077d2b69d7c1014e36d86c737f7eb4b057b7

plus test cases:

https://github.com/boostorg/regex/commit/36b2fab2271bc97f8fae86029f587747f9fc1ff4 https://github.com/boostorg/regex/commit/e217808156e482dc1af6b97799e39a2fdfabe3fd

Note that strictly speaking this is still only a partial fix as basic_regex<uintmax_t> could still only parse values up until the largest value of intmax_t. It should fix this for char32_t etc though.

Note: See TracTickets for help on using tickets.