mirror of
https://github.com/nlohmann/json.git
synced 2026-10-01 06:25:17 +00:00
Classify a NUL inside a string of json_view as a control character
json::parse ends the input at a NUL only between values (where it does at all); inside a string, a NUL is a control character that must be escaped. The view reported it as a missing closing quote. (Only the error code differed: the exception comes from the library parser.) Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -262,10 +262,8 @@ class builder
|
||||
}
|
||||
if (c != '\\')
|
||||
{
|
||||
if (NulIsEnd && c == 0)
|
||||
{
|
||||
return failed(error_code::string_missing_quote, p);
|
||||
}
|
||||
// (a NUL before the end of the input is a control character, as
|
||||
// for json::parse, also where a NUL ends the input between values)
|
||||
return failed(c < 0x20 ? error_code::string_control_character : error_code::string_utf8, p);
|
||||
}
|
||||
++p;
|
||||
|
||||
Reference in New Issue
Block a user