Commit d07f3aae authored by Robert Pluim's avatar Robert Pluim

Replace NUL characters when calling into libxml

2019-02-27  Robert Pluim  <rpluim@gmail.com>

* lisp/net/eww.el (eww-display-html): Replace NUL characters with
"\0", as libxml can't handle embedded NULLs.  (Bug#34469)
parent 9564fc33
Pipeline #868 passed with stage
in 59 minutes and 46 seconds
......@@ -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)))))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment