I have following code:
int main(int argc, char *argv[])
{
const char jsonInput[] = R"__({ "Object": "value" })__";
unique_ptr<json_tokener, void(*)(struct json_tokener *)> tokener(json_tokener_new(), json_tokener_free);
unique_ptr<json_object, int(*)(struct json_object *)> data(json_tokener_parse_ex(tokener.get(), jsonInput, 21), json_object_put);
return 0;
}
It does almost nothing. It tries to parse the simpliest JSON object with json-c 0.12.99. It works good:
- On any Windows version when I compile it with Visual Studio 2013.
- On Linxu when I compile it with
clangorgcc. - On Windows 7 when I compile it with Visual Studio 2015.
But: it is guaranteed to crash when I compile it with Visual Studio 2015 and run on Windows 10. The stack trace follows:
check_bytes(const unsigned char * const first, const unsigned char value, const unsigned __int64 size) Line 194 C++
is_block_an_aligned_allocation(const void * const block) Line 252 C++
free_dbg_nolock(void * const block, const int block_use) Line 870 C++
_free_dbg(void * block, int block_use) Line 1011 C++
free(void * block) Line 20 C++
json_object_lh_entry_free(lh_entry * ent) Line 409 C++
lh_table_free(lh_table * t) Line 567 C++
json_object_object_delete(json_object * jso) Line 415 C++
json_object_put(json_object * jso) Line 188 C++
std::unique_ptr::~unique_ptr() Line 1397 C++
main(int argc, char * * argv) Line 47 C++
Does anyone know what is the reason of the crash?
Aucun commentaire:
Enregistrer un commentaire