If a json string is parsed and contains a string literal with a \u that is not followed by hex digits, a range_error is thrown by from_hex_digit, but the surrounding code doesn't expect that.
The parse_string() function, which calls the string decoding, only handles decode_error, not range_error. Probably this function should handle range_error in the same way, or string_decode() should already convert it into a decode_error when parsing the \u escape.
The exception can for example be triggered by this:
If a json string is parsed and contains a string literal with a
\u
that is not followed by hex digits, arange_error
is thrown byfrom_hex_digit
, but the surrounding code doesn't expect that.The
parse_string()
function, which calls the string decoding, only handlesdecode_error
, notrange_error
. Probably this function should handlerange_error
in the same way, orstring_decode()
should already convert it into adecode_error
when parsing the\u
escape.The exception can for example be triggered by this: