diff options
| author | Paul Eggert | 2018-12-31 23:07:33 -0800 |
|---|---|---|
| committer | Paul Eggert | 2018-12-31 23:35:55 -0800 |
| commit | 8e25ffeec6345249f2a5d221fcb0622d1deaee27 (patch) | |
| tree | d9577f07bd5152b4aeb9f390adc00d1b86bc17a7 | |
| parent | a04bf15130f5d4e1bc79e1709461fe95345bdb2a (diff) | |
| download | emacs-8e25ffeec6345249f2a5d221fcb0622d1deaee27.tar.gz emacs-8e25ffeec6345249f2a5d221fcb0622d1deaee27.zip | |
Fix integer overflow check in json code
* src/json.c (json_to_lisp): Check for ptrdiff_t overflow,
not fixnum overflow.
| -rw-r--r-- | src/json.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c index 46fb97a99e8..b5fb3fee059 100644 --- a/src/json.c +++ b/src/json.c | |||
| @@ -815,7 +815,7 @@ json_to_lisp (json_t *json, struct json_configuration *conf) | |||
| 815 | if (++lisp_eval_depth > max_lisp_eval_depth) | 815 | if (++lisp_eval_depth > max_lisp_eval_depth) |
| 816 | xsignal0 (Qjson_object_too_deep); | 816 | xsignal0 (Qjson_object_too_deep); |
| 817 | size_t size = json_array_size (json); | 817 | size_t size = json_array_size (json); |
| 818 | if (FIXNUM_OVERFLOW_P (size)) | 818 | if (PTRDIFF_MAX < size) |
| 819 | overflow_error (); | 819 | overflow_error (); |
| 820 | Lisp_Object result = make_vector (size, Qunbound); | 820 | Lisp_Object result = make_vector (size, Qunbound); |
| 821 | for (ptrdiff_t i = 0; i < size; ++i) | 821 | for (ptrdiff_t i = 0; i < size; ++i) |