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.
This commit is contained in:
Nicolas Goaziou 2013-02-26 00:29:04 +01:00
parent ef6c1498b4
commit 36f5aa316f
1 changed files with 4 additions and 4 deletions

View File

@ -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)