diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-08-06 16:57:08 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-08-06 16:58:35 -0700 |
commit | 93511e94735de5862880f5ea9bf12705c1440363 (patch) | |
tree | 8c02753b243688359639e31ed215bc25a19813af /nt | |
parent | 8a406d1185b6c87f6647c141a1cc06786cd9480d (diff) | |
download | emacs-93511e94735de5862880f5ea9bf12705c1440363.tar.gz |
Fix some crashes on self-modifying Elisp code
Prompted by a problem report by Alex in:
http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00143.html
* src/eval.c (For, Fprogn, Fsetq, FletX, eval_sub):
Compute XCDR (x) near XCAR (x); although this doesn't fix any bugs,
it is likely to run a bit faster with typical hardware caches.
(Fif): Use Fcdr instead of XCDR, to avoid crashing on
self-modifying S-expressions.
(Fsetq, Flet, eval_sub): Count the number of arguments as we go
instead of trusting an Flength prepass, to avoid problems when the
code is self-modifying.
(Fquote, Ffunction, Fdefvar, Fdefconst): Prefer !NILP to CONSP
where either will do. This is mostly to document the fact that
the value must be a proper list. It's also a tiny bit faster on
typical machines nowadays.
(Fdefconst, FletX): Prefer XCAR+XCDR to Fcar+Fcdr when either will do.
(eval_sub): Check that the args are a list as opposed to some
other object that has a length. This prevents e.g. (if . "string")
from making Emacs dump core in some cases.
* test/src/eval-tests.el (eval-tests--if-dot-string)
(eval-tests--let-with-circular-defs, eval-tests--mutating-cond):
New tests.
Diffstat (limited to 'nt')
0 files changed, 0 insertions, 0 deletions