]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix regex stack overflow in gdb-mi.el when parsing complex locals
authorDavid McFarland <corngood@gmail.com>
Sat, 30 Dec 2017 11:14:32 +0000 (13:14 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 30 Dec 2017 11:14:32 +0000 (13:14 +0200)
* lisp/progmodes/gdb-mi.el (gdb-jsonify-buffer): Skip string
literals with (forward-sexp) instead of matching with regex.
(Bug#29868)

Copyright-paperwork-exempt: yes

lisp/progmodes/gdb-mi.el

index 58552759b9582780795ed81b654f98bb47e1a3d6..84b8c6b44b1674d66417c28ac37b8d3d1f84169a 100644 (file)
@@ -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 "}")))