* bug#29868: [PATCH 0/1] regex stack overflow in gdb-jsonify-buffer
@ 2017-12-27 15:32 David McFarland
2017-12-27 15:32 ` bug#29868: [PATCH 1/1] Fix regex stack overflow when parsing complex gdb locals David McFarland
0 siblings, 1 reply; 3+ messages in thread
From: David McFarland @ 2017-12-27 15:32 UTC (permalink / raw)
To: 29868; +Cc: David McFarland
https://stackoverflow.com/questions/2882488/debugging-in-emacs-with-gud-often-results-in-stack-overflow-error
In some of my C++ projects, gdb will happily print 60+k characters for the value
of a local, which causes a stack overflow in the regex used by
gdb-jsonify-buffer. This patch instead looks for the start of a string literal
and uses (forward-sexp) to skip it, which was proposed in the answer to the
stackoverflow question above. This results in the same output in the tests that
I've done, but I wouldn't say it's been extensively tested.
David McFarland (1):
Fix regex stack overflow when parsing complex gdb locals
lisp/progmodes/gdb-mi.el | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--
2.15.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#29868: [PATCH 1/1] Fix regex stack overflow when parsing complex gdb locals
2017-12-27 15:32 bug#29868: [PATCH 0/1] regex stack overflow in gdb-jsonify-buffer David McFarland
@ 2017-12-27 15:32 ` David McFarland
2017-12-30 11:16 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: David McFarland @ 2017-12-27 15:32 UTC (permalink / raw)
To: 29868; +Cc: David McFarland
* 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#29868: [PATCH 1/1] Fix regex stack overflow when parsing complex gdb locals
2017-12-27 15:32 ` bug#29868: [PATCH 1/1] Fix regex stack overflow when parsing complex gdb locals David McFarland
@ 2017-12-30 11:16 ` Eli Zaretskii
0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2017-12-30 11:16 UTC (permalink / raw)
To: David McFarland; +Cc: 29868-done
> From: David McFarland <corngood@gmail.com>
> Date: Wed, 27 Dec 2017 11:32:11 -0400
> Cc: David McFarland <corngood@gmail.com>
>
> * lisp/progmodes/gdb-mi.el (gdb-jsonify-buffer): Skip string literals
> with (forward-sexp) instead of matching with regex.
>
> Copyright-paperwork-exempt: yes
Thanks, pushed to the master branch.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-30 11:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-27 15:32 bug#29868: [PATCH 0/1] regex stack overflow in gdb-jsonify-buffer David McFarland
2017-12-27 15:32 ` bug#29868: [PATCH 1/1] Fix regex stack overflow when parsing complex gdb locals David McFarland
2017-12-30 11:16 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.