aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2020-03-13 19:51:02 +0100
committerMattias EngdegÄrd2020-03-14 09:32:29 +0100
commit7195ea7532f4b2e05f168da823d9aed2401267cf (patch)
treea27d64b50a7c0eec26785478973e02c83458acde
parent6bdb561a3bafa0623da30e33b4a1dc291370218b (diff)
downloademacs-7195ea7532f4b2e05f168da823d9aed2401267cf.tar.gz
emacs-7195ea7532f4b2e05f168da823d9aed2401267cf.zip
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.
-rw-r--r--lisp/progmodes/gdb-mi.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index da5a2a503a6..c2622327967 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."
1046 1046
1047(declare-function tooltip-show "tooltip" (text &optional use-echo-area)) 1047(declare-function tooltip-show "tooltip" (text &optional use-echo-area))
1048 1048
1049(defconst gdb--string-regexp "\"\\(?:[^\\\"]\\|\\\\.\\)*\"") 1049(defconst gdb--string-regexp (rx "\""
1050 (* (or (seq "\\" nonl)
1051 (not (any "\"\\"))))
1052 "\""))
1050 1053
1051(defun gdb-tooltip-print (expr) 1054(defun gdb-tooltip-print (expr)
1052 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) 1055 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)