Bug in lexertl library (in Spirit)

Hi There is a bug in the lexertl library. This library is being used in spirit but being prepared for submission to boost as a separate library. The file consts.hpp contains the lines: const std::size_t num_wchar_ts = (boost::integer_traits<wchar_t>::const_max < 0x110000) ? boost::integer_traits<wchar_t>::const_max: 0x110000; Which should be: const std::size_t num_wchar_ts = (boost::integer_traits<wchar_t>::const_max + 1 < 0x110000) ? boost::integer_traits<wchar_t>::const_max + 1: 0x110000; Currently the lexer will cause a buffer overflow parsing a 0xffff value in a wchar_t buffer (assuming sizeof(wchar_t) is 2). Best regards, Alex

There is a bug in the lexertl library. This library is being used in spirit but being prepared for submission to boost as a separate library. The file consts.hpp contains the lines:
const std::size_t num_wchar_ts = (boost::integer_traits<wchar_t>::const_max < 0x110000) ? boost::integer_traits<wchar_t>::const_max: 0x110000;
Which should be:
const std::size_t num_wchar_ts = (boost::integer_traits<wchar_t>::const_max + 1 < 0x110000) ? boost::integer_traits<wchar_t>::const_max + 1: 0x110000;
Currently the lexer will cause a buffer overflow parsing a 0xffff value in a wchar_t buffer (assuming sizeof(wchar_t) is 2).
Thanks for the report. I forwarded this message to Ben (Hanson) since I don't know if he is watching the Boost list right now. Let's see what he says. Regards Hartmut
participants (2)
-
Alejandro Rivero Pérez
-
Hartmut Kaiser