From 36f5aa316fd008d869d555fb137048319de4cc8f Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 26 Feb 2013 00:29:04 +0100 Subject: [PATCH] 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. --- lisp/ox-html.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 628cf84c3..a3ec565a6 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
 tags.
-	  (if (string-match "]*>\n*\\([^\000]*\\)" code)
-	      (match-string 1 code)
-	    code))))))))
+	  ;; Strip any enclosing 
 tags.
+	  (let* ((beg (and (string-match "\\`]*>\n*" code) (match-end 0)))
+		 (end (and beg (string-match "\\'" code))))
+	    (if (and beg end) (substring code beg end) code)))))))))
 
 (defun org-html-do-format-code
   (code &optional lang refs retain-labels num-start)
-- 
2.11.4.GIT