#3136: Fixed null character issue when parsing a JSON

This commit is contained in:
Günter Obiltschnig
2021-04-12 20:28:30 +02:00
parent e4b258765e
commit e577e36c25
2 changed files with 15 additions and 1 deletions

View File

@@ -1935,6 +1935,15 @@ void JSONTest::testEscape0()
json->stringify(ss);
assertTrue (ss.str().compare("{\"name\":\"B\\u0000b\"}") == 0);
// parse the JSON containing the escaped string
Poco::JSON::Parser parser(new Poco::JSON::ParseHandler());
Var result = parser.parse(ss.str());
assert(result.type() == typeid(Object::Ptr));
Object::Ptr object = result.extract<Object::Ptr>();
assert(object->get("name").extract<std::string>() == nullString);
}