Public bug reported:

The following code parses the JSON string successfully, but then asserts
where indicated:

    Json::Value root;
    Json::Reader reader;
    std::string s = R"(
        "a": "b" 
    )";
    if (!reader.parse(s, root))
        abort();
    std::cerr << "parse OK" << std::endl;

    auto a = root["a"];  // Asserts at json_value.cpp:1136

The output is:

parse OK
src/lib_json/json_value.cpp:1136: Json::Value& 
Json::Value::resolveReference(const char*, bool): Assertion `type_ == nullValue 
|| type_ == objectValue' failed.

parse() should report that the parse failed, but doesn't.

** Affects: libjsoncpp (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1331904

Title:
  Assertion with invalid JSON string

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libjsoncpp/+bug/1331904/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to