diff --git a/include/fc/io/json.hpp b/include/fc/io/json.hpp index 10b5314..d7c1b0f 100644 --- a/include/fc/io/json.hpp +++ b/include/fc/io/json.hpp @@ -21,8 +21,9 @@ namespace fc #ifdef WITH_EXOTIC_JSON_PARSERS strict_parser = 1, relaxed_parser = 2, - legacy_parser_with_string_doubles = 3 + legacy_parser_with_string_doubles = 3, #endif + broken_nul_parser = 4 }; enum output_formatting { diff --git a/src/io/json.cpp b/src/io/json.cpp index 5d23e70..6230fd1 100644 --- a/src/io/json.cpp +++ b/src/io/json.cpp @@ -441,6 +441,9 @@ namespace fc case EOF: FC_THROW_EXCEPTION( eof_exception, "unexpected end of file" ); case 0: + if( parser_type == fc::json::broken_nul_parser ) + return variant(); + [[fallthrough]]; default: FC_THROW_EXCEPTION( parse_error_exception, "Unexpected char '${c}' in \"${s}\"", ("c", c)("s", stringFromToken(in)) );