emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d07f3aa: Replace NUL characters when calling into l


From: Robert Pluim
Subject: [Emacs-diffs] master d07f3aa: Replace NUL characters when calling into libxml
Date: Wed, 27 Feb 2019 11:20:38 -0500 (EST)

branch: master
commit d07f3aae48242ad70e874c2d10fc15b7e1efa4d6
Author: Robert Pluim <address@hidden>
Commit: Robert Pluim <address@hidden>

    Replace NUL characters when calling into libxml
    
    2019-02-27  Robert Pluim  <address@hidden>
    
    * lisp/net/eww.el (eww-display-html): Replace NUL characters with
    "\0", as libxml can't handle embedded NULLs.  (Bug#34469)
---
 lisp/net/eww.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index d37a481..3ec6c1c 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -470,10 +470,12 @@ Currently this means either text/html or 
application/xhtml+xml."
                (condition-case nil
                    (decode-coding-region (point) (point-max) encode)
                  (coding-system-error nil))
-                (save-excursion
-                  ;; Remove CRLF before parsing.
-                  (while (re-search-forward "\r$" nil t)
-                    (replace-match "" t t)))
+               (save-excursion
+                 ;; Remove CRLF and NULL before parsing.
+                  (while (re-search-forward "\\(\r$\\)\\|\\(\000\\)" nil t)
+                    (replace-match (if (match-beginning 1)
+                                       ""
+                                     "\\0") t t)))
                (libxml-parse-html-region (point) (point-max))))))
        (source (and (null document)
                     (buffer-substring (point) (point-max)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]