summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-13 09:05:59 +0900
committerLennart Poettering <lennart@poettering.net>2018-11-14 10:44:18 +0100
commitd4a389eb5f00035064863d938354d7b325018a28 (patch)
tree95023b4b13560c8665688471f277fb57f6c5c4f6
parent080a0178f8fe42102eb364e161c372f939c36050 (diff)
downloadsystemd-d4a389eb5f00035064863d938354d7b325018a28.tar.gz
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.
-rw-r--r--src/basic/json.c7
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 {