diff options
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c index 16500bce72d..256d485eead 100644 --- a/src/json.c +++ b/src/json.c @@ -495,7 +495,14 @@ lisp_to_json (Lisp_Object lisp, struct json_configuration *conf) else if (EQ (lisp, Qt)) return json_check (json_true ()); else if (INTEGERP (lisp)) - return json_check (json_integer (INTEGER_TO_INT (lisp, json_int_t))); + { + intmax_t low = TYPE_MINIMUM (json_int_t); + intmax_t high = TYPE_MAXIMUM (json_int_t); + intmax_t value; + if (! (integer_to_intmax (lisp, &value) && low <= value && value <= high)) + args_out_of_range_3 (lisp, make_int (low), make_int (high)); + return json_check (json_integer (value)); + } else if (FLOATP (lisp)) return json_check (json_real (XFLOAT_DATA (lisp))); else if (STRINGP (lisp)) |