emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#34769: closed (Bug in emacs 26.1 gdb-send match-st


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#34769: closed (Bug in emacs 26.1 gdb-send match-string applied after non-matching string-match)
Date: Thu, 07 Mar 2019 15:19:01 +0000

Your message dated Thu, 07 Mar 2019 17:18:20 +0200
with message-id <address@hidden>
and subject line Re: bug#34769: Bug in emacs 26.1 gdb-send match-string applied 
after non-matching string-match
has caused the debbugs.gnu.org bug report #34769,
regarding Bug in emacs 26.1 gdb-send match-string applied after non-matching 
string-match
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
34769: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=34769
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Bug in emacs 26.1 gdb-send match-string applied after non-matching string-match Date: Wed, 6 Mar 2019 12:27:03 +0100 (CET)
Dear Emacs maintainers,

At the end of gdb-send one finds the following lines:

  (let* ((control-command-p (string-match gdb-control-commands-regexp string))
         (command-arg (match-string 3 string))

It is wrong to call (match-string 3 string) if (string-match 
gdb-control-commands-regexp string) returned nil.
The doc of match-string says:
"Return string of text matched by last search."
That means match-string only returns sensible results if the last match was 
successful.

Possible correction:

  (let* ((control-command-p (string-match gdb-control-commands-regexp string))
         (command-arg (and control-command-p (match-string 3 string)))


System info:
GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 
2018-05-29

Best regards,
Tobias



--- End Message ---
--- Begin Message --- Subject: Re: bug#34769: Bug in emacs 26.1 gdb-send match-string applied after non-matching string-match Date: Thu, 07 Mar 2019 17:18:20 +0200
> Date: Wed, 6 Mar 2019 21:10:54 +0100 (CET)
> From: Tobias Zawada <address@hidden>
> Cc: address@hidden
> 
> Dear Eli,
> thanks for looking into this.
> 
> > > It is wrong to call (match-string 3 string) if (string-match 
> > > gdb-control-commands-regexp string) returned nil.
> > ...
> > That is true, and a cleanup is a good idea. But please note that the
> > undefined results are not used if control-command-p is nil, so the
> > issue is not that serious.
> 
> The match data is that one of the previous successful matching operation.
> One gets an args-out-of-range signal if the indexes in the match data are 
> larger than the width of the string argument to match-string. That is how I 
> discovered the error.

You are right; I've now fixed this on the emacs-26 branch.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]