diff options
| author | Paul Eggert | 2019-06-27 12:31:27 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-06-27 12:35:08 -0700 |
| commit | 4893a09c005cac81c05cd3db05c87225be6a7b42 (patch) | |
| tree | 1e1e193f61c97067076a1b2f0940c79d5e92ed33 /src/data.c | |
| parent | 3502d4c1b587057c2f5907997f74ae0a2e0d2a7d (diff) | |
| download | emacs-4893a09c005cac81c05cd3db05c87225be6a7b42.tar.gz emacs-4893a09c005cac81c05cd3db05c87225be6a7b42.zip | |
Clean up use of XFIXNUM etc.
A few bits of the code were relying on the fact that XFIXNUM,
XFIXNAT, and XUFIXNUM do something even with arguments that
are not fixnums/fixnats. Separate these rare uses out into
XFIXNUM_RAW and XUFIXNUM_RAW.
Problem and original patch reported by Pip Cet (Bug#36370).
* src/ccl.c (Fccl_execute_on_string):
* src/fileio.c (Finsert_file_contents, a_write)
(Fdo_auto_save):
* src/process.c (conv_lisp_to_sockaddr):
* src/textprop.c (Fnext_single_char_property_change)
(Fprevious_single_char_property_change)
(Fnext_property_change, Fnext_single_property_change)
(Fprevious_property_change)
(Fprevious_single_property_change):
Don’t assume fixnums are nonnegative.
* src/ccl.c (Fccl_execute_on_string):
Fix range-checking bug if AREF (status, i) is out of int range.
* src/data.c (arith_driver): Use XFIXNUM_RAW as we want
efficient garbage if the value is not a fixnum.
* src/dosfns.c (Fint86, Fdos_memput):
Check that args are nonnegative.
* src/image.c (lookup_image): Check that args are in range.
* src/lisp.h (lisp_h_XHASH): Use XUFIXNUM_RAW, since this
is for hashing.
(lisp_h_XFIXNAT, XFIXNAT) [USE_LSB_TAG]: Remove macros.
(lisp_h_XFIXNUM_RAW, XFIXNUM_RAW) [USE_LSB_TAG]: New macros, with
the semantics of the old macros without _RAW.
(XFIXNUM_RAW, XUFIXNUM_RAW): New inline functions, with the
semantics of the old functions without _RAW.
(FIXNUMP): Move definition up to avoid forward use.
(XFIXNUM, XFIXNAT, XUFIXNUM): Use eassume to add a runtime
check (when debugging) that the argument has the proper form.
(XFIXNUM, XFIXNAT): Now inline functions only, since they
refer to their arguments more than once now that they use eassume.
* src/textprop.c (Fprevious_single_char_property_change):
Avoid fixnum overflow with invalid input.
(set_text_properties): Fix unlikely failure
to validate arguments, by using EQ instead of XFIXNAT.
* src/w32term.c (w32_draw_glyph_string):
* src/xterm.c (x_draw_glyph_string):
Treat negative minimums as 0 rather than as garbage patterns.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/data.c b/src/data.c index c1699aeae73..46bd7e0e253 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2928,7 +2928,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args, | |||
| 2928 | ptrdiff_t argnum = 0; | 2928 | ptrdiff_t argnum = 0; |
| 2929 | /* Set ACCUM to VAL's value if it is a fixnum, otherwise to some | 2929 | /* Set ACCUM to VAL's value if it is a fixnum, otherwise to some |
| 2930 | ignored value to avoid using an uninitialized variable later. */ | 2930 | ignored value to avoid using an uninitialized variable later. */ |
| 2931 | intmax_t accum = XFIXNUM (val); | 2931 | intmax_t accum = XFIXNUM_RAW (val); |
| 2932 | 2932 | ||
| 2933 | if (FIXNUMP (val)) | 2933 | if (FIXNUMP (val)) |
| 2934 | while (true) | 2934 | while (true) |