webmcp
changeset 182:b460ae08dd78
json.import does support even more nested levels
author | jbe |
---|---|
date | Sat Aug 02 02:53:32 2014 +0200 (2014-08-02) |
parents | c2e76617c26c |
children | f7c1869b5b32 |
files | libraries/json/json.c |
line diff
1.1 --- a/libraries/json/json.c Sat Aug 02 02:38:18 2014 +0200 1.2 +++ b/libraries/json/json.c Sat Aug 02 02:53:32 2014 +0200 1.3 @@ -5,10 +5,10 @@ 1.4 #include <math.h> 1.5 1.6 // maximum number of nested JSON values (objects and arrays): 1.7 -// NOTE: json_import can store (2^31-1) / 3 levels on stack swap; 1.8 -// one additional level is kept on the Lua stack, resulting 1.9 -// in 715827883 possible nested levels. 1.10 -#define JSON_MAXDEPTH 715827883 1.11 +// NOTE: json_import can store 2^32 / 3 levels on stack swap (using 1.12 +// also negative indicies after integer wraparound), so 1.13 +// 1024^3 = 1073741824 is a safe value. 1.14 +#define JSON_MAXDEPTH (1024*1024*1024) 1.15 // NOTE: As long as the function json_export_internal is implemented 1.16 // recursively, JSON_MAXDEPTH needs to be low (e.g. 50) to avoid C stack 1.17 // overflows.