# HG changeset patch # User jbe # Date 1406940812 -7200 # Node ID b460ae08dd78b8587ec9b37d527d7950e4bf4ec6 # Parent c2e76617c26cf586106112a9c0310e0018438dc5 json.import does support even more nested levels diff -r c2e76617c26c -r b460ae08dd78 libraries/json/json.c --- a/libraries/json/json.c Sat Aug 02 02:38:18 2014 +0200 +++ b/libraries/json/json.c Sat Aug 02 02:53:32 2014 +0200 @@ -5,10 +5,10 @@ #include // maximum number of nested JSON values (objects and arrays): -// NOTE: json_import can store (2^31-1) / 3 levels on stack swap; -// one additional level is kept on the Lua stack, resulting -// in 715827883 possible nested levels. -#define JSON_MAXDEPTH 715827883 +// NOTE: json_import can store 2^32 / 3 levels on stack swap (using +// also negative indicies after integer wraparound), so +// 1024^3 = 1073741824 is a safe value. +#define JSON_MAXDEPTH (1024*1024*1024) // 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.