miloyip / nativejson-benchmark

C/C++ JSON parser/generator benchmark
MIT License
1.98k stars 261 forks source link

SIGSEGV if nativejson is run from certain directories #108

Open cebtenzzre opened 6 years ago

cebtenzzre commented 6 years ago

If the nativejson binary is run from certain directories (such as the root of the repository), ReadFiles fails twice: https://github.com/miloyip/nativejson-benchmark/blob/2d4e633eac404625a04dd77c0bfb53712ccb3ecd/src/main.cpp#L1238 So testJsons has length 0 and capacity 0. That makes testJsons.front() invalid, as no memory has been allocated for the vector yet. So here: https://github.com/miloyip/nativejson-benchmark/blob/2d4e633eac404625a04dd77c0bfb53712ccb3ecd/src/main.cpp#L726 A null pointer is dereferenced, causing a segfault.