all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Pit--Claudel" <clement.pitclaudel@live.com>
To: 25222@debbugs.gnu.org
Subject: bug#25222: Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
Date: Sun, 18 Dec 2016 11:07:09 -0500	[thread overview]
Message-ID: <727f1fe3-3f61-02c8-5858-1f87ccfb54f5@live.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1773 bytes --]

Package: emacs
X-Debbugs-CC: Daniel Colascione <dancol@dancol.org>

Hi all,

The following snippet throws an out-of-bounds error on master and in Emacs 25.:

(ansi-color-filter-apply
 (base64-decode-string "UHl0aG9uIDIuNy4xMiAoZGVmYXVsdCwgTm92IDE5IDIwMTYsIDA2OjQ4OjEwKSAKVHlwZSAiY29w
eXJpZ2h0IiwgImNyZWRpdHMiIG9yICJsaWNlbnNlIiBmb3IgbW9yZSBpbmZvcm1hdGlvbi4KCklQ
eXRob24gNS4xLjAgLS0gQW4gZW5oYW5jZWQgSW50ZXJhY3RpdmUgUHl0aG9uLgo/ICAgICAgICAg
LT4gSW50cm9kdWN0aW9uIGFuZCBvdmVydmlldyBvZiBJUHl0aG9uJ3MgZmVhdHVyZXMuCiVxdWlj
a3JlZiAtPiBRdWljayByZWZlcmVuY2UuCmhlbHAgICAgICAtPiBQeXRob24ncyBvd24gaGVscCBz
eXN0ZW0uCm9iamVjdD8gICAtPiBEZXRhaWxzIGFib3V0ICdvYmplY3QnLCB1c2UgJ29iamVjdD8/
JyBmb3IgZXh0cmEgZGV0YWlscy4KChtbPzFsG1s2bhtbPzIwMDRoG1s/MjVsG1s/N2wbWzBtDRtb
MG0bW0oNG1s/MTJsG1s/MjVoG1tKG1swbRtbPzIwMDRsG1s2bhtbPzIwMDRoG1s/MjVsG1s/N2wb
WzBtG1swbRtbShtbMDszODs1OzI4bUluIFsbWzA7Mzg7NTsxMDsxbTEbWzA7Mzg7NTsyOG1dOiAb
WzhEG1s4QxtbPzEybBtbPzI1aA=="))

This is caused by the following snippet:

    ;; find the next escape sequence
    (while (setq end (string-match ansi-color-regexp string start))
      (setq result (concat result (substring string start end))
            start (match-end 0)))
    ;; eliminate unrecognized escape sequences
    (while (string-match ansi-color-drop-regexp string)
      (setq string
            (replace-match "" nil nil string)))
    ;; save context, add the remainder of the string to the result
    (let (fragment)
      (if (string-match "\033" string start)

(the error happens on the last line).  The "unrecognized escape sequences" part does not adjust the "start" variable.

Maybe that section could just be moved up (before "find the next escape sequence")? Daniel, what do you think?

Cheers,
Clément.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

             reply	other threads:[~2016-12-18 16:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-18 16:07 Clément Pit--Claudel [this message]
2017-01-11 18:24 ` bug#25222: Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25) Glenn Morris
2017-01-12 16:06   ` Eli Zaretskii
2017-01-12 16:46     ` Clément Pit--Claudel
2017-01-12 17:04       ` Glenn Morris
2017-01-12 17:38         ` Clément Pit--Claudel
2017-01-12 17:13       ` Daniel Colascione

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=727f1fe3-3f61-02c8-5858-1f87ccfb54f5@live.com \
    --to=clement.pitclaudel@live.com \
    --cc=25222@debbugs.gnu.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 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.