You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NLohmann JSON version 3.10.4 has binary arrays: https://json.nlohmann.me/api/basic_json/binary/
If such array is encountered in JSON object, pyjson::from_json() crashes with stack overflow because it falls to "else // Object" clause and then the for() loop tries to iterate over non-existing values, since binary array is not an object.
Proposed fix:
Add include file:
#include "pybind11/numpy.h"
In pyjson::from_json() add:
...
else if (j.is_binary())
{
const auto &bin = j.get_binary();
return py::array( bin.size(), bin.data() );
}
else // Object
{
...
The text was updated successfully, but these errors were encountered:
IMHO, not.
See, pybind11/numpy.h header is a part of pybind11 distro, and since pybind11 is header-only library, it does not create any extra dependency.
pybind11/numpy.h does not have any pragma linker directives, so I would assume no extra linking.
NLohmann JSON version 3.10.4 has binary arrays: https://json.nlohmann.me/api/basic_json/binary/
If such array is encountered in JSON object, pyjson::from_json() crashes with stack overflow because it falls to "else // Object" clause and then the for() loop tries to iterate over non-existing values, since binary array is not an object.
Proposed fix:
Add include file:
#include "pybind11/numpy.h"
In pyjson::from_json() add:
...
else if (j.is_binary())
{
const auto &bin = j.get_binary();
return py::array( bin.size(), bin.data() );
}
else // Object
{
...
The text was updated successfully, but these errors were encountered: