]> git.eshelyaron.com Git - emacs.git/commit
Avoid memory corruption with specpdl overflow + edebug (Bug#30481)
authorNoam Postavsky <npostavs@gmail.com>
Fri, 16 Feb 2018 03:13:51 +0000 (22:13 -0500)
committerNoam Postavsky <npostavs@gmail.com>
Sat, 17 Feb 2018 03:13:34 +0000 (22:13 -0500)
commitc352434ab89617b48c7c1f29342a22e5a5685504
tree0a6e535935d8f9a4a2691b30f7324573d48068d3
parent593bbdaf0b890924e9d10918ba6de206bddc2eb6
Avoid memory corruption with specpdl overflow + edebug (Bug#30481)

If grow_specpdl fails due to outgrowing max_specpdl_size, it will
signal an error *before* growing the specpdl array.  Therefore, when
handling the signal, specpdl_ptr points past the end of the specpdl
array and any further use of of specpdl before unwinding (e.g., if
edebug binds signal-hook-function) will cause memory corruption.
* src/eval.c (signal_or_quit): Don't call `signal-hook-function' if
the specpdl_ptr is already past the end of the specpdl array.
* test/src/eval-tests.el (eval-tests--exceed-specbind-limit)
(eval-exceed-specbind-with-signal-hook): New test & helper function.
src/eval.c
test/src/eval-tests.el