]> git.eshelyaron.com Git - emacs.git/commit
Remove recursion from character escape handling in reader
authorMattias Engdegård <mattiase@acm.org>
Fri, 10 Mar 2023 16:10:30 +0000 (17:10 +0100)
committerMattias Engdegård <mattiase@acm.org>
Sat, 11 Mar 2023 09:21:23 +0000 (10:21 +0100)
commitb8e7061232f9a5b06af70031dcc4b48c6575a364
tree357abc8cfd14a58874b58e6a89f50e8dfe4320b4
parentc6bfffa9fe1af7f4f806e5533ba5f3c33476cf9a
Remove recursion from character escape handling in reader

This cures a C stack overflow when reading certain long (crafted)
strings (bug#62039) and improves performance of reading escaped
characters in character and string literals.
Reported by Bruno Haible.

* src/lread.c (invalid_escape_syntax_error): New.
(read_escape): Rename to...
(read_char_escape): ...this.  Remove recursion.  Pass read-ahead char
as argument.  Improve code performance and clarity.
(read_char_literal, read_string_literal): Update calls.
* test/src/lread-tests.el (lread-char-modifiers)
(lread-many-modifiers): Add test cases.
src/lread.c
test/src/lread-tests.el