Opened 11 years ago
Closed 11 years ago
#5807 closed Bugs (fixed)
Debug build of the program asserts calling iscntrl(c) in boost::spirit::detail::token_printer_debug_for_chars::print(), with c == -127
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | To Be Determined | Component: | spirit |
Version: | Boost 1.47.0 | Severity: | Problem |
Keywords: | Cc: |
Description
When using a hexidecimal string that contains a negative value with the attached parser causes an assert to be thrown when calling iscntrl(c) in boost::spirit::detail::token_printer_debug_for_chars::print(), with c == -127. Disabling debug output allows the program to succeed and produce the following output:
successfully parsed 33026 772
Attached is a sample program that causes the error. The program was tested with Visual Studio 2010 (SP1) and Visual Studio 2008 (Boost 1.45).
Attachments (1)
Change History (3)
by , 11 years ago
comment:1 by , 11 years ago
I changed boost/spirit/home/support/attributes.hpp at line 950 to be:
else if ( c >= 0 && c < 127 && iscntrl(c))
o << "
" << std::oct << static_cast<int>(c);
I read that the windows api expects that to be a value within the range of 0x00 - 0x1F or 0x7F despite the fact that the input parameter type for that function is a regular integer. The linux api also uses a int. So we cannot rely on the type checking to save us here. We have to constrain the range of values for 'c' to be within the range of 0 and 126.
Stephen
comment:2 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Standalone program that exposes the assert in iscntrl