You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi i find a core when use error string to a parser。
My code is:
char my_string[1024] = "{\"name\": \"Jack \" Nimble\"}";
printf("string is %s\n",my_string);
cJSON *root = cJSON_Parse(my_string);
if(root ==NULL)
printf("parse error");
and the result is :
string is {"name": "Jack " Nimble"}
Segmentation fault
it is core in cJSON *root = cJSON_Parse(my_string);
and if i change the string to right json:
char my_string[1024] = "{\"name\: \"Jack Nimble\"}";
it is work well。
The text was updated successfully, but these errors were encountered:
sorry I am wrong。For my question, the compiler should optimize my code. My subsequent code will still call root, and he may be executed before the error is printed.
Hi i find a core when use error string to a parser。
My code is:
char my_string[1024] = "{\"name\": \"Jack \" Nimble\"}";
printf("string is %s\n",my_string);
cJSON *root = cJSON_Parse(my_string);
if(root ==NULL)
printf("parse error");
and the result is :
string is {"name": "Jack " Nimble"}
Segmentation fault
it is core in cJSON *root = cJSON_Parse(my_string);
and if i change the string to right json:
char my_string[1024] = "{\"name\: \"Jack Nimble\"}";
it is work well。
The text was updated successfully, but these errors were encountered: