all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#62039: Emacs crashes while parsing a long Emacs Lisp string
@ 2023-03-07 21:51 Bruno Haible
  2023-03-08  9:39 ` Mattias Engdegård
  0 siblings, 1 reply; 3+ messages in thread
From: Bruno Haible @ 2023-03-07 21:51 UTC (permalink / raw)
  To: 62039

[-- Attachment #1: Type: text/plain, Size: 845 bytes --]

When parsing a particular long Emacs Lisp string, Emacs crashes.

How to reproduce:

$ emacs -Q -batch -f batch-byte-compile foo.el
Segmentation fault

Find attached the compressed file foo.el.

Emacs version: 27.1
Platform: x86_64-linux-gnu
$ ulimit -a | grep stack
stack size                  (kbytes, -s) 8192

According to the documentation
https://www.gnu.org/software/emacs/manual/html_node/emacs/Bug-Criteria.html
any segmentation fault is a bug.

I haven't analyzed the security impact of this bug, but it is quite possible
that emacs receives a string through the network, and even though the string
is not meant to be evaluated, simply parsing it causes a denial-of-service
to the emacs user.

The cause of the bug is that in emacs/src/lread.c the function read_escape()
is recursive, and no bound on the recursion depth is enforced.


[-- Attachment #2: foo.el.gz --]
[-- Type: application/gzip, Size: 1042 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#62039: Emacs crashes while parsing a long Emacs Lisp string
  2023-03-07 21:51 bug#62039: Emacs crashes while parsing a long Emacs Lisp string Bruno Haible
@ 2023-03-08  9:39 ` Mattias Engdegård
  2023-03-11  9:25   ` Mattias Engdegård
  0 siblings, 1 reply; 3+ messages in thread
From: Mattias Engdegård @ 2023-03-08  9:39 UTC (permalink / raw)
  To: Bruno Haible; +Cc: 62039

> The cause of the bug is that in emacs/src/lread.c the function read_escape() is recursive, and no bound on the recursion depth is enforced. 

Dear me, I meant to remove that recursion during the last reader renovation but got sidetracked.

Will fix. Thank you very much for noticing and reporting this bug.






^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#62039: Emacs crashes while parsing a long Emacs Lisp string
  2023-03-08  9:39 ` Mattias Engdegård
@ 2023-03-11  9:25   ` Mattias Engdegård
  0 siblings, 0 replies; 3+ messages in thread
From: Mattias Engdegård @ 2023-03-11  9:25 UTC (permalink / raw)
  To: Bruno Haible; +Cc: 62039-done

Now fixed on master. Thanks again for the report.






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-11  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-07 21:51 bug#62039: Emacs crashes while parsing a long Emacs Lisp string Bruno Haible
2023-03-08  9:39 ` Mattias Engdegård
2023-03-11  9:25   ` Mattias Engdegård

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.