Conversation
Throw's an exception when i is nullptr, also added a testcase for this scenario though most likely in the wrong test file.cpp
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @jordan-hoang |
nlohmann
left a comment
There was a problem hiding this comment.
Please also consider the case that
nlohmann::json::parse(nullptr);is called. This is then interpreted as FILE*, so please adjust inline file_input_adapter input_adapter(std::FILE* file) to also throw and exception if nullptr is provided.
|
(Also, please update to the latest develop branch to have a green CI) |
|
Gotcha, ahh so that's what it is, I noticed errors going away when I updated / merged from develop. |
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @jordan-hoang |
nlohmann
left a comment
There was a problem hiding this comment.
Please run "make amalgamate" using Astyle 3.1 (https://astyle.sourceforge.net) to fix the CI issues.
|
Note "make pretty" is not sufficient as it only indents the files in |
nlohmann
left a comment
There was a problem hiding this comment.
I added some comments to fix some errors in the CI.
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @jordan-hoang |
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @jordan-hoang |
|
Sorry about all these tiny commits, I make the changes on a windows push em and then do the make amalgamate on a linux vm I have. Should really get make setup for windows so I don't have to do that. |
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @jordan-hoang |
|
Thanks a lot!!! |
* Possible fix for nlohmann#4485 Throw's an exception when i is nullptr, also added a testcase for this scenario though most likely in the wrong test file.cpp * quick cleanup * Fix compile issues * moved tests around, changed exceptions, removed a possibly unneeded include * add back include <memory> for testing something * Ninja doesn't like not having a \n, at end of file, adding it back * update input_adapter file to deal with empty/null file ptr. * ran make pretty * added test for inputadapter * ran make amalgamate * Update tests/src/unit-deserialization.cpp Co-authored-by: Niels Lohmann <[email protected]> * Update tests/src/unit-deserialization.cpp Co-authored-by: Niels Lohmann <[email protected]> * Update input adapters.hpp with new includes * fix unabigious use of _, (there was a double declare) * did the amalagamate * rm duplicate includes * make amalgamate again * reorder * amalgamate * moved it above * amalgamate --------- Co-authored-by: Jordan <[email protected]> Co-authored-by: Niels Lohmann <[email protected]>
Description
This fixes an issue with getting a crash when passing in a null string to json::parse(). It instead throws an exception.
Also added in a testcase to check for this.
Link to issue.
#4485
include/nlohmanndirectory, runmake amalgamateto create the single-header filessingle_include/nlohmann/json.hppandsingle_include/nlohmann/json_fwd.hpp. The whole process is described here.