GNU bug report logs -
#7496
23.2; copy recursive keymap cause crash
Previous Next
Reported by: ARISAWA Akihiro <ari <at> mbf.ocn.ne.jp>
Date: Sat, 27 Nov 2010 01:04:02 UTC
Severity: minor
Tags: fixed
Found in version 23.2
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 7496 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> When I call `copy-keymap' with a keymap which contains recursive binding,
>> the emacs crashed.
>> I can reproduce it by following sexp.
>
>> (let ((map (make-sparse-keymap)))
>> (define-key map " " map)
>> (copy-keymap map))
>
> I'm not surprised. There are many ways to address it:
> - try and make sure we better handle the "using up all memory" case
> rather than crashing. This is very difficult. We already try to do
> it, but clearly it's not working that well.
> - try and detect such cycles and either signal an error or reproduce the
> same cycle in the copy. We have added such things in several other
> cases, so we should probably do that.
While this is a pretty obscure, Emacs shouldn't crash on stuff like
this. I first considered whether just to check for EQ in Fcopy_keymap,
but it's possible to have nested keymaps that are mutually recursive,
so that won't work.
So I just added a recursion counter and refuse to copy when we've
reached level 100.
It does not protect against the case where the keymap is a char table
where one of the entries is the same keymap, but I don't know whether
that's a thing.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 5 years and 283 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.