akheron / jansson

C library for encoding, decoding and manipulating JSON data
http://www.digip.org/jansson/
Other
3.05k stars 808 forks source link

Jansson crashed when receiving emptied sub-object #637

Closed DennisDNguy closed 1 year ago

DennisDNguy commented 1 year ago

I got a segmentation fault from my device when testing with the following emptied sub-object { "deviceIdentifier": "1B35D979", "timestamp": "2022-10-24T14:09:57Z", "payload": {} } Probably it failed from json_object_foreach(obj, key, value) called function.

DennisDNguy commented 1 year ago

The issue resolved, Because of the payload was emptied, the "value" that from json_object_foreach() called function was return NULL. json_object_foreach(obj, key, value); Using the value for next called function caused sytem to crash. I was calling: parse_json_aux(value); while value was NULL.