# HG changeset patch # User jbe # Date 1406932705 -7200 # Node ID 461e5353ffb1111266b1fe93e87e94f4c2ee5867 # Parent 1a85110cdbe2927ceeb9353c39003183cf864ae0 Limit max depth of JSON documents to 50 (until a better implementation of json.export is available) diff -r 1a85110cdbe2 -r 461e5353ffb1 libraries/json/json.c --- a/libraries/json/json.c Fri Aug 01 23:08:42 2014 +0200 +++ b/libraries/json/json.c Sat Aug 02 00:38:25 2014 +0200 @@ -13,6 +13,12 @@ // this is detected nevertheless and an error is thrown (instead of // returning nil and an error string). #define JSON_MAXDEPTH 500 +// NOTE: As long as the function json_export_internal is implemented +// recursively, JSON_MAXDEPTH needs to be low (e.g. 50) to avoid C stack +// overflows. +#if JSON_MAXDEPTH > 50 +#define JSON_MAXDEPTH 50 +#endif // generate dummy memory addresses that represents null values: char json_nullmark;