-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
corrupted size vs. prev_size (aborted) #2092
Comments
Can you please try to create a std::string and check if it works then? |
Same issue with std::string. P.S. string seems to be valid and shows up full 37544 bytes. |
I can't reproduce this. This code runs fine: #include <iostream>
#include <fstream>
#include "json.hpp"
using json = nlohmann::json;
int main()
{
std::ifstream f("/Users/niels/Downloads/feature.txt");
auto j = json::parse(f);
std::cout << j << std::endl;
} Can you share the code calling the parser? Can you run the code with address sanitizer? |
https://github.com/maxsupermanhd/WMT/blob/JSON-test/lib/wmt.cpp#L1078 |
I could compile and run without errors. This is the output: The only odd line (in my eyes) was:
|
Well, on your system it works... 🤔 It was failing on line 71... Did you built P.S. This line supposed to be here, some files have this field, some not. |
I now tried the
So it seems there is an issue executing ssize_t readed = zip_entry_read(map->zip, (void**)&content, &readlen); Then I think that invalid buffer explodes inside the JSON library, but the error is not related to it. |
Trying to read 37,5kb json feature.txt
Have malloc-ed chunk of memory of exact same size including NULL-terminating byte. Casting from void* to char* and passing to json::parse().
No exception thrown, nothing bad expected to happen. Instead was failing with abort.
Backtrace available here: https://pastebin.com/qTMyiMUp
Compiled, linked and made on Ubuntu 18.04.04 with CMake and make.
The text was updated successfully, but these errors were encountered: