diff options
| author | Mark Pulford <mark@kyne.com.au> | 2012-01-13 19:00:13 +1030 |
|---|---|---|
| committer | Mark Pulford <mark@kyne.com.au> | 2012-03-04 18:54:34 +1030 |
| commit | 93256124a6116e070f7857d9fe04bf6139dfbaee (patch) | |
| tree | 264b6ab5de8aa87db51c42016b79286dc4c29fa3 | |
| parent | 46ba498b003b1ac4898b8db39c9aea5158af093f (diff) | |
| download | lua-cjson-93256124a6116e070f7857d9fe04bf6139dfbaee.tar.gz lua-cjson-93256124a6116e070f7857d9fe04bf6139dfbaee.tar.bz2 lua-cjson-93256124a6116e070f7857d9fe04bf6139dfbaee.zip | |
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.
| -rw-r--r-- | lua_cjson.c | 4 | ||||
| -rw-r--r-- | 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 @@ | |||
| 62 | #define DEFAULT_SPARSE_CONVERT 0 | 62 | #define DEFAULT_SPARSE_CONVERT 0 |
| 63 | #define DEFAULT_SPARSE_RATIO 2 | 63 | #define DEFAULT_SPARSE_RATIO 2 |
| 64 | #define DEFAULT_SPARSE_SAFE 10 | 64 | #define DEFAULT_SPARSE_SAFE 10 |
| 65 | #define DEFAULT_ENCODE_MAX_DEPTH 20 | 65 | #define DEFAULT_ENCODE_MAX_DEPTH 1000 |
| 66 | #define DEFAULT_DECODE_MAX_DEPTH 20 | 66 | #define DEFAULT_DECODE_MAX_DEPTH 1000 |
| 67 | #define DEFAULT_ENCODE_INVALID_NUMBERS 0 | 67 | #define DEFAULT_ENCODE_INVALID_NUMBERS 0 |
| 68 | #define DEFAULT_DECODE_INVALID_NUMBERS 1 | 68 | #define DEFAULT_DECODE_INVALID_NUMBERS 1 |
| 69 | #define DEFAULT_ENCODE_KEEP_BUFFER 1 | 69 | #define DEFAULT_ENCODE_KEEP_BUFFER 1 |
| @@ -278,7 +278,7 @@ depth = cjson.decode_max_depth([depth]) | |||
| 278 | ------------ | 278 | ------------ |
| 279 | 279 | ||
| 280 | By default, Lua CJSON will reject JSON with arrays and/or objects | 280 | By default, Lua CJSON will reject JSON with arrays and/or objects |
| 281 | nested more than 20 deep. | 281 | nested more than 1000 deep. |
| 282 | 282 | ||
| 283 | This setting is only changed when an argument is provided. The current | 283 | This setting is only changed when an argument is provided. The current |
| 284 | setting is always returned. | 284 | setting is always returned. |
| @@ -372,7 +372,7 @@ This may not be required by some applications. | |||
| 372 | By default, the following Lua values will generate errors: | 372 | By default, the following Lua values will generate errors: |
| 373 | 373 | ||
| 374 | - Numbers incompatible with the JSON specification (NaN, Infinity, Hexadecimal) | 374 | - Numbers incompatible with the JSON specification (NaN, Infinity, Hexadecimal) |
| 375 | - Tables nested more than 20 levels deep | 375 | - Tables nested more than 1000 levels deep |
| 376 | - Excessively sparse Lua arrays | 376 | - Excessively sparse Lua arrays |
| 377 | 377 | ||
| 378 | These defaults can be changed with: | 378 | These defaults can be changed with: |
| @@ -441,7 +441,7 @@ depth = cjson.encode_max_depth([depth]) | |||
| 441 | -- "depth" must be a positive integer | 441 | -- "depth" must be a positive integer |
| 442 | ------------ | 442 | ------------ |
| 443 | 443 | ||
| 444 | By default, Lua CJSON will reject data structures with more than 20 | 444 | By default, Lua CJSON will reject data structures with more than 1000 |
| 445 | nested tables. | 445 | nested tables. |
| 446 | 446 | ||
| 447 | This setting is only changed when an argument is provided. The current | 447 | This setting is only changed when an argument is provided. The current |
