• Paul Eggert's avatar
    Fix crash if user test munges hash table · 515afc9c
    Paul Eggert authored
    * 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.
    515afc9c