I'm using cJSON on an Cortex-M4 MCU with a limited stack size. I set the CJSON_NESTING_LIMIT to 10, which works as expected when parsing. However, it seems cJSON_Print does not check CJSON_NESTING_LIMIT and leads a crash of the program.
In the code, I found the struct printbuffer does have a depth parameter. However, it's used just for printing and not checked for CJSON_NESTING_LIMIT. Adding an depth check in to print functions seems quite simple. Is there any reason not doing depth check when printing?
I'm using cJSON on an Cortex-M4 MCU with a limited stack size. I set the CJSON_NESTING_LIMIT to 10, which works as expected when parsing. However, it seems cJSON_Print does not check CJSON_NESTING_LIMIT and leads a crash of the program.
In the code, I found the struct printbuffer does have a depth parameter. However, it's used just for printing and not checked for CJSON_NESTING_LIMIT. Adding an depth check in to print functions seems quite simple. Is there any reason not doing depth check when printing?