]> git.eshelyaron.com Git - emacs.git/commit
Fix reader infinite recursion for circular mixed-type values
authorMattias Engdegård <mattiase@acm.org>
Sat, 26 Mar 2022 15:44:18 +0000 (16:44 +0100)
committerMattias Engdegård <mattiase@acm.org>
Sat, 26 Mar 2022 16:11:40 +0000 (17:11 +0100)
commit2dfeea8962751718168494c0560d69e678794b39
treefeb733329b75e74f0e3569706a0d17f3dcc79022
parente96061de95d053a4c5e303c7f75e0e928e474938
Fix reader infinite recursion for circular mixed-type values

Make sure that the value added to the `read_objects_completed` set is
the one we actually return; previously this wasn't the case for conses
because of an optimisation (bug#54501).

Also add a check for vacuous self-references such as #1=#1# instead of
returning a nonsense value from thin air.

* src/lread.c (read1): Treat numbered conses correctly as described
above.  Detect vacuous self-references.
* test/src/lread-tests.el (lread-test-read-and-print)
(lread-test-circle-cases, lread-circle): Add tests.
src/lread.c
test/src/lread-tests.el