all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: 18610@debbugs.gnu.org, maden.ldm@gmail.com
Subject: bug#18610: 24.4.50; Specific file causing emacs to segfault upon opening
Date: Fri, 03 Oct 2014 15:20:46 +0300	[thread overview]
Message-ID: <83a95dibtt.fsf@gnu.org> (raw)
In-Reply-To: <542E86E4.2030205@yandex.ru>

> Date: Fri, 03 Oct 2014 15:22:12 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> CC: Eli Zaretskii <eliz@gnu.org>, 18610@debbugs.gnu.org, 
>  maden.ldm@gmail.com
> 
> There is a reduced sample which is just 194 bytes (attached).

Thanks, I also arrived at such a shortened version.

But the shortest version is just this:

1B 96

IOW, you need an escape and a raw byte between 128 and 159
(inclusive).

> The whole thing is really subtle: when detect_coding is called, it finds (1) and
> calls to detect_coding_iso_2022, which returns 1.  Since this happens before
> detect_coding finds (2), this function assumes that the whole data is in one of
> 7-bit (?) ISO-2022 encoding.  Thus, no conversion is performed, and decode_coding_gap
> inserts the data as is; this way we end up with 96 3B byte sequence in buffer text.

Indeed.  But I don't think we can simply reject ISO-2022 here, because
the mere presence of bytes in [128..159] is not supposed to reject the
possibility of decoding that text by ISO-2022, see
latin-extra-code-table.

However, detect_coding_iso_2022 returns with the 'found' member of its
second argument having zero value, which I interpret as meaning that
it didn't really find any ISO-2022 sequences.  So the simple patch
below fixes this for me.  Kenichi, is this patch OK?

=== modified file 'src/coding.c'
--- src/coding.c	2014-08-06 17:37:22 +0000
+++ src/coding.c	2014-10-03 12:09:28 +0000
@@ -6559,7 +6559,8 @@ detect_coding (struct coding_system *cod
 		  && ! inhibit_ied
 		  && ! detect_info.checked)
 		{
-		  if (detect_coding_iso_2022 (coding, &detect_info))
+		  if (detect_coding_iso_2022 (coding, &detect_info)
+		      && detect_info.found != 0)
 		    {
 		      /* We have scanned the whole data.  */
 		      if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE))






  reply	other threads:[~2014-10-03 12:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-02 14:50 bug#18610: 24.4.50; Specific file causing emacs to segfault upon opening maden.ldm
2014-10-02 15:40 ` Nicolas Richard
2014-10-03  8:14   ` Eli Zaretskii
2014-10-03 11:22     ` Dmitry Antipov
2014-10-03 12:20       ` Eli Zaretskii [this message]
2014-10-03 12:39         ` Eli Zaretskii
2014-10-03 15:16           ` Andreas Schwab
2014-10-03 15:32             ` Eli Zaretskii
2014-10-03 16:02               ` Andreas Schwab
2014-10-03 16:35                 ` Eli Zaretskii
2014-10-03 16:40                   ` Andreas Schwab
2014-10-03 16:57                     ` Eli Zaretskii
2014-10-05  8:59         ` K. Handa
2014-10-05 16:09           ` Eli Zaretskii
2014-10-06 14:00             ` K. Handa
2014-10-06 15:20               ` Eli Zaretskii
2014-10-07 12:34                 ` K. Handa
2014-10-07 13:20                   ` Ivan Shmakov
2014-10-07 14:33                     ` Eli Zaretskii
2014-10-07 15:10                       ` Ivan Shmakov
2014-10-07 15:19                         ` Eli Zaretskii
2014-10-08  7:33                   ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a95dibtt.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=18610@debbugs.gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=maden.ldm@gmail.com \
    /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 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.