GNU bug report logs - #25222
Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)

Previous Next

Package: emacs;

Reported by: Clément Pit--Claudel <clement.pitclaudel <at> live.com>

Date: Sun, 18 Dec 2016 16:08:01 UTC

Severity: normal

Tags: fixed

Merged with 21381, 24189, 24223, 25306, 25363, 25416

Found in versions 24.5, 25.1, 25.1.50, 25.1.91

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25222 in the body.
You can then email your comments to 25222 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to dancol <at> dancol.org, bug-gnu-emacs <at> gnu.org:
bug#25222; Package emacs. (Sun, 18 Dec 2016 16:08:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Pit--Claudel <clement.pitclaudel <at> live.com>:
New bug report received and forwarded. Copy sent to dancol <at> dancol.org, bug-gnu-emacs <at> gnu.org. (Sun, 18 Dec 2016 16:08:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Incorrect indices in ansi-color
 (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
Date: Sun, 18 Dec 2016 11:07:09 -0500
[Message part 1 (text/plain, inline)]
Package: emacs
X-Debbugs-CC: Daniel Colascione <dancol <at> 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.


[signature.asc (application/pgp-signature, attachment)]

Merged 21381 25222. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 11 Jan 2017 18:19:01 GMT) Full text and rfc822 format available.

Merged 21381 24189 24223 25222. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 11 Jan 2017 18:20:02 GMT) Full text and rfc822 format available.

bug No longer marked as found in versions 24.5. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 11 Jan 2017 18:21:02 GMT) Full text and rfc822 format available.

Added indication that bug 25222 blocks24655 Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 11 Jan 2017 18:24:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25222; Package emacs. (Wed, 11 Jan 2017 18:25:02 GMT) Full text and rfc822 format available.

Message #16 received at 25222 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
Cc: daniel colascione <dancol <at> dancol.org>, 25222 <at> debbugs.gnu.org
Subject: Re: bug#25222: Incorrect indices in ansi-color
 (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
Date: Wed, 11 Jan 2017 13:24:31 -0500
There are several reports about this. Eg 24223, 21381, 24189.
Perhaps this is something to fix for 25.2.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25222; Package emacs. (Thu, 12 Jan 2017 16:07:01 GMT) Full text and rfc822 format available.

Message #19 received at 25222 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: clement.pitclaudel <at> live.com, 25222 <at> debbugs.gnu.org
Subject: Re: bug#25222: Incorrect indices in ansi-color
 (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
Date: Thu, 12 Jan 2017 18:06:53 +0200
> From: Glenn Morris <rgm <at> gnu.org>
> Date: Wed, 11 Jan 2017 13:24:31 -0500
> Cc: 25222 <at> debbugs.gnu.org
> 
> There are several reports about this. Eg 24223, 21381, 24189.
> Perhaps this is something to fix for 25.2.

I agree, and would encourage people to hurry with patches for these
problems, because RC1 of 25.2 is probably due in a week or two.




Added indication that bug 25222 blocks21966 Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 12 Jan 2017 16:45:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25222; Package emacs. (Thu, 12 Jan 2017 16:47:02 GMT) Full text and rfc822 format available.

Message #24 received at 25222 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Glenn Morris <rgm <at> gnu.org>
Cc: Daniel Colascione <dancol <at> dancol.org>, 25222 <at> debbugs.gnu.org
Subject: Re: bug#25222: Incorrect indices in ansi-color
 (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
Date: Thu, 12 Jan 2017 11:46:42 -0500
[Message part 1 (text/plain, inline)]
On 2017-01-12 11:06, Eli Zaretskii wrote:
>> From: Glenn Morris <rgm <at> gnu.org>
>> Date: Wed, 11 Jan 2017 13:24:31 -0500
>> Cc: 25222 <at> debbugs.gnu.org
>>
>> There are several reports about this. Eg 24223, 21381, 24189.
>> Perhaps this is something to fix for 25.2.
> 
> I agree, and would encourage people to hurry with patches for these
> problems, because RC1 of 25.2 is probably due in a week or two.

I posted a potential solution in a previous message, but I was hoping for the original author (Daniel) to comment on it.  Otherwise, I don't feel too comfortable touching that code.

Cheers,
Clément.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25222; Package emacs. (Thu, 12 Jan 2017 17:05:02 GMT) Full text and rfc822 format available.

Message #27 received at 25222 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Daniel Colascione <dancol <at> dancol.org>,
 25222 <at> debbugs.gnu.org
Subject: Re: bug#25222: Incorrect indices in ansi-color
 (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
Date: Thu, 12 Jan 2017 12:04:23 -0500
Clément Pit--Claudel wrote:

> I posted a potential solution in a previous message,

You mean the same one as in https://debbugs.gnu.org/24223 ?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25222; Package emacs. (Thu, 12 Jan 2017 17:14:02 GMT) Full text and rfc822 format available.

Message #30 received at 25222 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Colascione <dancol <at> dancol.org>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
Cc: Glenn Morris <rgm <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 25222 <at> debbugs.gnu.org
Subject: Re: bug#25222: Incorrect indices in ansi-color
 (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
Date: Thu, 12 Jan 2017 09:13:05 -0800
On Thu, Jan 12 2017, Clément Pit--Claudel wrote:
> On 2017-01-12 11:06, Eli Zaretskii wrote:
>>> From: Glenn Morris <rgm <at> gnu.org>
>>> Date: Wed, 11 Jan 2017 13:24:31 -0500
>>> Cc: 25222 <at> debbugs.gnu.org
>>>
>>> There are several reports about this. Eg 24223, 21381, 24189.
>>> Perhaps this is something to fix for 25.2.
>> 
>> I agree, and would encourage people to hurry with patches for these
>> problems, because RC1 of 25.2 is probably due in a week or two.
>
> I posted a potential solution in a previous message, but I was hoping
> for the original author (Daniel) to comment on it.  Otherwise, I don't
> feel too comfortable touching that code.

Gah, sorry. Personal issues lately.  I'll take another look at it.
I'm not really comfortable with that code at all, to be honest.  IMHO,
we should rewrite the escapes sequence parser as an explicit restartable
state machine instead of munging things with regular expressions.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25222; Package emacs. (Thu, 12 Jan 2017 17:40:01 GMT) Full text and rfc822 format available.

Message #33 received at 25222 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Daniel Colascione <dancol <at> dancol.org>,
 25222 <at> debbugs.gnu.org
Subject: Re: bug#25222: Incorrect indices in ansi-color
 (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
Date: Thu, 12 Jan 2017 12:38:42 -0500
[Message part 1 (text/plain, inline)]
On 2017-01-12 12:04, Glenn Morris wrote:
> Clément Pit--Claudel wrote:
> 
>> I posted a potential solution in a previous message,
> 
> You mean the same one as in https://debbugs.gnu.org/24223 ?

Yes; thanks for tracking that reference!

[signature.asc (application/pgp-signature, attachment)]

Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Mon, 03 Jul 2017 14:11:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.1, send any further explanations to 24223 <at> debbugs.gnu.org and Ivan Andrus <darthandrus <at> gmail.com> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Mon, 03 Jul 2017 14:11:03 GMT) Full text and rfc822 format available.

Forcibly Merged 21381 24189 24223 25222 25306 25363 25416. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Mon, 03 Jul 2017 15:24:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 01 Aug 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 324 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.