From: Carl Worth <cworth@cworth.org>
To: bug-gnu-emacs@gnu.org
Cc: Notmuch mailing list <notmuch@notmuchmail.org>
Subject: 23.1; json-read-string crashes emacs with long string
Date: Tue, 18 May 2010 09:08:17 -0700 [thread overview]
Message-ID: <87pr0t5h1q.fsf@yoom.home.cworth.org> (raw)
> Please describe exactly what actions triggered the bug
> and the precise symptoms of the bug:
A user of the emacs-based mail client, Notmuch [*], found that
attempting to display a particular message would consistently
causes a segmentation fault in emacs.
I tracked this down to calling `json-read-string' with a very long
string, (roughly 1 million characters). Rather than including that
enormous string in this message, here's a little snippet of emacs lisp
that creates and reads such a string. So, if evaluated, this code should
trigger the segmentation fault, (assuming a copy of GPLv3 exists at
/usr/share/emacs/23.1/etc/COPYING---adjust the filename if necessary).
;; Caution: Evaluating the block below has been known to crash emacs
(with-temp-buffer
(require 'json)
;; First we just need a lot of text. 32 copies of GPLv3 seems to do it
(dotimes (i 32)
(insert-file "/usr/share/emacs/23.1/etc/COPYING"))
;; Now create a buffer with a json-encoded version of the text
(let ((json-string (json-encode-string (buffer-string))))
(with-temp-buffer
(insert json-string)
(goto-char (point-min))
;; And try to read the string. This triggers the segfault.
(json-read-string))))
> If Emacs crashed, and you have the Emacs process in the gdb debugger,
> please include the output from the following gdb commands:
> `bt full' and `xbacktrace'.
I haven't attempted to debug this within gdb yet, (I'll have to get my
hands on a build of emacs with debugging symbols first). But I wanted to
share things right away, so that perhaps someone else could do further
debugging and follow up.
In the meantime, notmuch folks, if you've got a good idea for modifying
notmuch to avoid this bug I'd be glad to hear it. Adjust followups to
include the notmuch list and not the gnu.org bug address as appropriate.
-Carl
[*] http://notmuchmail.org
PS. Here are some of the details provided by `report-emacs-bug':
In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.18.2)
of 2010-01-26 on raven, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10799001
configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: nil
locale-coding-system: utf-8-unix
default-enable-multibyte-characters: t
--
carl.d.worth@intel.com
next reply other threads:[~2010-05-18 16:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-18 16:08 Carl Worth [this message]
2010-05-18 18:07 ` bug#6214: 23.1; json-read-string crashes emacs with long string Chong Yidong
2010-08-12 21:58 ` Michal Sojka
2010-08-13 16:37 ` Chong Yidong
2010-08-14 7:39 ` Michal Sojka
2010-08-14 21:30 ` Chong Yidong
2010-08-15 7:37 ` Michal Sojka
2010-08-16 17:40 ` Chong Yidong
2010-08-16 20:39 ` Michal Sojka
2010-08-17 15:10 ` Chong Yidong
2010-08-17 16:27 ` Chong Yidong
2010-08-17 20:57 ` Andreas Schwab
2010-08-17 21:46 ` Chong Yidong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pr0t5h1q.fsf@yoom.home.cworth.org \
--to=cworth@cworth.org \
--cc=bug-gnu-emacs@gnu.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).