emacs-diffs
[Top][All Lists]
Advanced

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

master 7195ea7: Avoid regexp stack overflow in GDB string matching (bug#


From: Mattias Engdegård
Subject: master 7195ea7: Avoid regexp stack overflow in GDB string matching (bug#22149)
Date: Sat, 14 Mar 2020 04:32:48 -0400 (EDT)

branch: master
commit 7195ea7532f4b2e05f168da823d9aed2401267cf
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    Avoid regexp stack overflow in GDB string matching (bug#22149)
    
    * lisp/progmodes/gdb-mi.el (gdb--string-regexp):
    Swap the or-clauses so that the rarely matching one comes first.
    This avoids a build-up of backtrack points on the regexp stack.
---
 lisp/progmodes/gdb-mi.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index da5a2a5..c262232 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1046,7 +1046,10 @@ no input, and GDB is waiting for input."
 
 (declare-function tooltip-show "tooltip" (text &optional use-echo-area))
 
-(defconst gdb--string-regexp "\"\\(?:[^\\\"]\\|\\\\.\\)*\"")
+(defconst gdb--string-regexp (rx "\""
+                                 (* (or (seq "\\" nonl)
+                                        (not (any "\"\\"))))
+                                 "\""))
 
 (defun gdb-tooltip-print (expr)
   (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)



reply via email to

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