diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2013-02-26 00:29:04 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2013-02-26 00:29:04 +0100 |
commit | 36f5aa316fd008d869d555fb137048319de4cc8f (patch) | |
tree | 8909eb5b1cc6ecf26a3ca980b12697ece2be3114 | |
parent | ef6c1498b4ee9d3a2cd8badc782d97c172edd8d9 (diff) | |
download | org-mode-36f5aa316fd008d869d555fb137048319de4cc8f.tar.gz |
ox-html: Fix stack overflow in regexp matching
* lisp/ox-html.el (org-html-fontify-code): Do not use [^\000] in
regexps that may match large strings.
Thanks to Kyle Machulis for reporting it.
-rw-r--r-- | lisp/ox-html.el | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 628cf84..a3ec565 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -1478,10 +1478,10 @@ is the language used for CODE, as a string, or nil." ;; Htmlize region. (org-html-htmlize-region-for-paste (point-min) (point-max)))) - ;; Strip any encolosing <pre></pre> tags. - (if (string-match "<pre[^>]*>\n*\\([^\000]*\\)</pre>" code) - (match-string 1 code) - code)))))))) + ;; Strip any enclosing <pre></pre> tags. + (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0))) + (end (and beg (string-match "</pre>\\'" code)))) + (if (and beg end) (substring code beg end) code))))))))) (defun org-html-do-format-code (code &optional lang refs retain-labels num-start) |