Commit 8e25ffee authored by Paul Eggert's avatar Paul Eggert
Browse files

Fix integer overflow check in json code

* src/json.c (json_to_lisp): Check for ptrdiff_t overflow,
not fixnum overflow.
parent a04bf151
Pipeline #421 failed with stage
in 22 minutes and 28 seconds
...@@ -815,7 +815,7 @@ json_to_lisp (json_t *json, struct json_configuration *conf) ...@@ -815,7 +815,7 @@ json_to_lisp (json_t *json, struct json_configuration *conf)
if (++lisp_eval_depth > max_lisp_eval_depth) if (++lisp_eval_depth > max_lisp_eval_depth)
xsignal0 (Qjson_object_too_deep); xsignal0 (Qjson_object_too_deep);
size_t size = json_array_size (json); size_t size = json_array_size (json);
if (FIXNUM_OVERFLOW_P (size)) if (PTRDIFF_MAX < size)
overflow_error (); overflow_error ();
Lisp_Object result = make_vector (size, Qunbound); Lisp_Object result = make_vector (size, Qunbound);
for (ptrdiff_t i = 0; i < size; ++i) for (ptrdiff_t i = 0; i < size; ++i)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment