#24 Invalid string can lead to crash in libjson::read

closed-invalid
nobody
None
5
2012-03-10
2011-12-09
No

When feeding an invalid string like [{"a":"b","c":{"d":"e","f":"g","e":"f to libjson::read it crashes instead of throwing/returning NULL.

Discussion

  • Moritz Hilger

    Moritz Hilger - 2011-12-09

    using libjson::is_valid does work, though

     
  • Jonathan Wallace

    Please post your JSONOptions.h file contents. I am unable to duplicate this problem, however I added it to my unit test suite to be sure.

    Test:
    assertException(libjson::parse(JSON_TEXT("[{\"a\":\"b\",\"c\":{\"d\":\"e\",\"f\":\"g\",\"e\":\"f ")), std::invalid_argument);
    Results:
    TestNamespace.cpp - Parse: std::invalid_argument caught

     
  • Jonathan Wallace

    is JSON_SAFE defined? The only way I can make the string yo provided crash libjson is if JSON_SAFE is not defined, in which it is expected behavior.

     
  • Moritz Hilger

    Moritz Hilger - 2012-02-19

    you're right, I got the JSONOptions.h wrong

     
  • Jonathan Wallace

    • status: open --> closed-invalid
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks