unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25222: Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
@ 2016-12-18 16:07 Clément Pit--Claudel
  2017-01-11 18:24 ` Glenn Morris
  0 siblings, 1 reply; 7+ messages in thread
From: Clément Pit--Claudel @ 2016-12-18 16:07 UTC (permalink / raw)
  To: 25222


[-- 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 --]

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

* bug#25222: Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
  2016-12-18 16:07 bug#25222: Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25) Clément Pit--Claudel
@ 2017-01-11 18:24 ` Glenn Morris
  2017-01-12 16:06   ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2017-01-11 18:24 UTC (permalink / raw)
  To: Clément Pit--Claudel; +Cc: 25222


There are several reports about this. Eg 24223, 21381, 24189.
Perhaps this is something to fix for 25.2.





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

* bug#25222: Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
  2017-01-11 18:24 ` Glenn Morris
@ 2017-01-12 16:06   ` Eli Zaretskii
  2017-01-12 16:46     ` Clément Pit--Claudel
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2017-01-12 16:06 UTC (permalink / raw)
  To: Glenn Morris; +Cc: clement.pitclaudel, 25222

> From: Glenn Morris <rgm@gnu.org>
> Date: Wed, 11 Jan 2017 13:24:31 -0500
> Cc: 25222@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.





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

* bug#25222: Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
  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:13       ` Daniel Colascione
  0 siblings, 2 replies; 7+ messages in thread
From: Clément Pit--Claudel @ 2017-01-12 16:46 UTC (permalink / raw)
  To: Eli Zaretskii, Glenn Morris; +Cc: 25222


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

On 2017-01-12 11:06, Eli Zaretskii wrote:
>> From: Glenn Morris <rgm@gnu.org>
>> Date: Wed, 11 Jan 2017 13:24:31 -0500
>> Cc: 25222@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.


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

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

* bug#25222: Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
  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
  1 sibling, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2017-01-12 17:04 UTC (permalink / raw)
  To: Clément Pit--Claudel; +Cc: 25222

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 ?





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

* bug#25222: Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
  2017-01-12 16:46     ` Clément Pit--Claudel
  2017-01-12 17:04       ` Glenn Morris
@ 2017-01-12 17:13       ` Daniel Colascione
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel Colascione @ 2017-01-12 17:13 UTC (permalink / raw)
  To: Clément Pit--Claudel; +Cc: 25222

On Thu, Jan 12 2017, Clément Pit--Claudel wrote:
> On 2017-01-12 11:06, Eli Zaretskii wrote:
>>> From: Glenn Morris <rgm@gnu.org>
>>> Date: Wed, 11 Jan 2017 13:24:31 -0500
>>> Cc: 25222@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.





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

* bug#25222: Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25)
  2017-01-12 17:04       ` Glenn Morris
@ 2017-01-12 17:38         ` Clément Pit--Claudel
  0 siblings, 0 replies; 7+ messages in thread
From: Clément Pit--Claudel @ 2017-01-12 17:38 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 25222


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

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!


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

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

end of thread, other threads:[~2017-01-12 17:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-18 16:07 bug#25222: Incorrect indices in ansi-color (227e996946d4629fa8f6d665564a37668290c87f, new in Emacs 25) Clément Pit--Claudel
2017-01-11 18:24 ` 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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).