]> git.eshelyaron.com Git - emacs.git/commit
Fix crash if user test munges hash table
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 21 Jul 2019 02:40:03 +0000 (19:40 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 21 Jul 2019 03:13:46 +0000 (20:13 -0700)
commit515afc9c15870cd7bd6b96e2d8b89938116923ac
treee57bf126a8e6076edb1c4fa87e4908c94fd8d779
parentb6f194a0fb6dbd1b19aa01f95a955f5b8b23b40e
Fix crash if user test munges hash table

* src/fns.c (restore_mutability)
(hash_table_user_defined_call): New functions.
(cmpfn_user_defined, hashfn_user_defined): Use them.
(make_hash_table, copy_hash_table):
Mark new hash table as mutable.
(check_mutable_hash_table): New function.
(Fclrhash, Fputhash, Fremhash): Use it instead of CHECK_IMPURE.
* src/lisp.h (struct hash_table_test): User-defined functions
now take pointers to struct Lisp_Hash_Table, not to struct
hash_table_test.  All uses changed.
(struct Lisp_Hash_Table): New member ‘mutable’.
* src/pdumper.c (dump_hash_table): Copy it.
* test/src/fns-tests.el (test-hash-function-that-mutates-hash-table):
New test, which tests for the bug.
src/alloc.c
src/bytecode.c
src/composite.c
src/fns.c
src/lisp.h
src/pdumper.c
src/profiler.c
test/src/fns-tests.el