diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-11-13 01:05:59 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-11-14 10:44:18 +0100 |
commit | d4a389eb5f00035064863d938354d7b325018a28 (patch) | |
tree | 95023b4b13560c8665688471f277fb57f6c5c4f6 /src/basic | |
parent | hwdb: Add accelerometer orientation quirk for the Chuwi CoreBook tablet (diff) | |
download | systemd-d4a389eb5f00035064863d938354d7b325018a28.tar.xz systemd-d4a389eb5f00035064863d938354d7b325018a28.zip |
json: decrease DEPTH_MAX to 4k
This makes DEPTH_MAX lower value, as test-json fails with stack
overflow.
Note that the test can pass with 8k, but for safety, here set to 4k.
Fixes #10738.
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/json.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/basic/json.c b/src/basic/json.c index 8bbb69674a..53ac80a6c6 100644 --- a/src/basic/json.c +++ b/src/basic/json.c @@ -24,10 +24,11 @@ #include "terminal-util.h" #include "utf8.h" -/* Refuse putting together variants with a larger depth than 16K by default (as a protection against overflowing stacks +/* Refuse putting together variants with a larger depth than 4K by default (as a protection against overflowing stacks * if code processes JSON objects recursively. Note that we store the depth in an uint16_t, hence make sure this - * remains under 2^16. */ -#define DEPTH_MAX (16U*1024U) + * remains under 2^16. + * The value was 16k, but it was discovered to be too high on llvm/x86-64. See also the issue #10738. */ +#define DEPTH_MAX (4U*1024U) assert_cc(DEPTH_MAX <= UINT16_MAX); typedef struct JsonSource { |