diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-08-15 02:18:06 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2019-08-15 02:18:44 -0700 |
commit | 3548fd8a53869ce6b42c47f690660cb8eddb8aab (patch) | |
tree | 4da084bfab97e61c649abb3332254d0ea898188f /lisp/emacs-lisp | |
parent | 6cbf73b5f9f51b5e25b855bf9f521c1ef070dd4a (diff) | |
download | emacs-3548fd8a53869ce6b42c47f690660cb8eddb8aab.tar.gz emacs-3548fd8a53869ce6b42c47f690660cb8eddb8aab.tar.bz2 emacs-3548fd8a53869ce6b42c47f690660cb8eddb8aab.zip |
Debug out-of-range make_fixnum args
With --enable-checking, make_fixnum (N) now checks that N is
in fixnum range. Suggested by Pip Cet in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00548.html
A new function make_ufixnum (N) is for the rare cases where N
is intended to be unsigned and is in the range 0..INTMASK.
* configure.ac (AC_C_TYPEOF): Add.
(HAVE_STATEMENT_EXPRESSIONS): Resurrect this macro.
* src/fns.c (Frandom, hashfn_eq, hashfn_equal, hashfn_user_defined):
* src/profiler.c (hashfn_profiler):
Use make_ufixnum rather than make_fixum, since the argument is
an unsigned integer in the range 0..INTMASK rather than a signed
integer in the range MOST_NEGATIVE_FIXNUM..MOST_POSITIVE_FIXNUM.
Typically this is for hashes.
* src/lisp.h (lisp_h_make_fixnum_wrap) [USE_LSB_TAG]:
Rename from lisp_h_make_fixnum.
(lisp_h_make_fixnum): Redefine in terms of lisp_h_make_fixnum_wrap.
Check for fixnum overflow on compilers like GCC that
have statement expressions and typeof.
(FIXNUM_OVERFLOW_P): Move up.
(make_fixnum): Check for fixnum overflow.
(make_ufixnum): New function, which checks that the arg
fits into 0..INTMASK range.
Diffstat (limited to 'lisp/emacs-lisp')
0 files changed, 0 insertions, 0 deletions