From 93256124a6116e070f7857d9fe04bf6139dfbaee Mon Sep 17 00:00:00 2001 From: Mark Pulford Date: Fri, 13 Jan 2012 19:00:13 +1030 Subject: Change default nesting limits to 1000 Increase the default nesting limits to reduce the chance of accidently throwing an error on valid JSON out of the box. --- lua_cjson.c | 4 ++-- manual.txt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lua_cjson.c b/lua_cjson.c index 1e9e91d..772790e 100644 --- a/lua_cjson.c +++ b/lua_cjson.c @@ -62,8 +62,8 @@ #define DEFAULT_SPARSE_CONVERT 0 #define DEFAULT_SPARSE_RATIO 2 #define DEFAULT_SPARSE_SAFE 10 -#define DEFAULT_ENCODE_MAX_DEPTH 20 -#define DEFAULT_DECODE_MAX_DEPTH 20 +#define DEFAULT_ENCODE_MAX_DEPTH 1000 +#define DEFAULT_DECODE_MAX_DEPTH 1000 #define DEFAULT_ENCODE_INVALID_NUMBERS 0 #define DEFAULT_DECODE_INVALID_NUMBERS 1 #define DEFAULT_ENCODE_KEEP_BUFFER 1 diff --git a/manual.txt b/manual.txt index dce7090..85f3955 100644 --- a/manual.txt +++ b/manual.txt @@ -278,7 +278,7 @@ depth = cjson.decode_max_depth([depth]) ------------ By default, Lua CJSON will reject JSON with arrays and/or objects -nested more than 20 deep. +nested more than 1000 deep. This setting is only changed when an argument is provided. The current setting is always returned. @@ -372,7 +372,7 @@ This may not be required by some applications. By default, the following Lua values will generate errors: - Numbers incompatible with the JSON specification (NaN, Infinity, Hexadecimal) -- Tables nested more than 20 levels deep +- Tables nested more than 1000 levels deep - Excessively sparse Lua arrays These defaults can be changed with: @@ -441,7 +441,7 @@ depth = cjson.encode_max_depth([depth]) -- "depth" must be a positive integer ------------ -By default, Lua CJSON will reject data structures with more than 20 +By default, Lua CJSON will reject data structures with more than 1000 nested tables. This setting is only changed when an argument is provided. The current -- cgit v1.2.3-55-g6feb