vivkin / gason

Lightweight and fast JSON parser for C++
MIT License
338 stars 51 forks source link

Program terminated with signal SIGSEGV #38

Closed y-m-j closed 2 years ago

y-m-j commented 2 years ago

Hi,

I have been using the gason tool to flash set of binaries i.e., .FLS files. In this process using older vjson binary worked absolutely fine, but the latest Gason binaries gave the error as : Thread 1 "downloadtool" received signal SIGSEGV, Segmentation fault. __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65 65 ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.

Thanks in advance for any help on why this error.

vivkin commented 2 years ago

Hi, do you have more detailed stacktrace? There is no calls to strlen in gason

y-m-j commented 2 years ago

I think issue is in my usage of the right varaibles in gason.h : line 59 struct JsonNode { JsonValue value; JsonNode next; char key; };

Can you point to these same variables in Vjson release ? I did a gdb backtrace and got the issue with : key variable.

vivkin commented 2 years ago

Maybe you iterating an array? In arrays key feild contains garbage

y-m-j commented 2 years ago

I'm porting from the variable I used earlier in Vjson from : value->parent->name and in Gason to : value->value.toNode()->key

This is causing the issue, so can you help me with what is the appropriate replacement for "name" variable in your code base.

vivkin commented 2 years ago

Unfortunately in gason you can't access to node parent. You could track it by hand while iterating

y-m-j commented 2 years ago

Thanks, The issue in my case was : -- value->value.toNode()->key ++ value->key