Subject: Re: bug#34769: Bug in emacs 26.1 gdb-send match-string applied after non-matching string-match

From: Eli Zaretskii <[email-masked]>
Date: Wed, 06 Mar 2019 20:18:07 +0200

> Date: Wed, 6 Mar 2019 12:27:03 +0100 (CET)
> From: Tobias Zawada <[email-masked]>
> 
> 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.

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.

Thanks.