Closed jakitliang closed 4 weeks ago
Can you share the code with that you parse that JSON?
This works without issue:
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
auto j = json::parse(R"({
"version": [2, 6, 0, 109],
"path": "C:\\Users\\Jakit\\Documents\\data\\data"
})");
std::cout << j << std::endl;
}
Can you share the code with that you parse that JSON?
This works without issue:
#include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { auto j = json::parse(R"({ "version": [2, 6, 0, 109], "path": "C:\\Users\\Jakit\\Documents\\data\\data" })"); std::cout << j << std::endl; }
The JSON string
was store in a file data.json
.
And I had found that was my fault. I got a negative number from std::ifstream::tellg
then use this number as bufferSize
to create a buffer storing the JSON string
.
File exists but somewhere code may not correct.
So the research result is that json::parse
a dirty buffer char[1024] includes some bytes like <0x09>
<0x01>
would crash.
And I close this issue since I fix some my issues of the file reading and buffer caching.
Thanks much!
Description
Example data (dump from LLDB):
Reproduction steps
Just parse the JSON then crashing
Crash position:
Expected vs. actual results
no crashing
Minimal code example
Error messages
Critical error detected c0000374
Compiler and operating system
MSVC 2019
Library version
main\origin
Validation
develop
branch is used.