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

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

bug#29868: [PATCH 1/1] Fix regex stack overflow when parsing complex gdb


From: David McFarland
Subject: bug#29868: [PATCH 1/1] Fix regex stack overflow when parsing complex gdb locals
Date: Wed, 27 Dec 2017 11:32:11 -0400

* lisp/progmodes/gdb-mi.el (gdb-jsonify-buffer): Skip string literals
with (forward-sexp) instead of matching with regex.

Copyright-paperwork-exempt: yes
---
 lisp/progmodes/gdb-mi.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 58552759b9..84b8c6b44b 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -2717,10 +2717,10 @@ If `default-directory' is remote, full file names are 
adapted accordingly."
               (insert "]"))))))
     (goto-char (point-min))
     (insert "{")
-    (let ((re (concat "\\([[:alnum:]-_]+\\)=\\({\\|\\[\\|\"\"\\|"
-                      gdb--string-regexp "\\)")))
+    (let ((re (concat "\\([[:alnum:]-_]+\\)=")))
       (while (re-search-forward re nil t)
-        (replace-match "\"\\1\":\\2" nil nil)))
+        (replace-match "\"\\1\":" nil nil)
+        (if (eq (char-after) ?\") (forward-sexp) (forward-char))))
     (goto-char (point-max))
     (insert "}")))
 
-- 
2.15.1






reply via email to

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