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)
This commit is contained in:
parent
9564fc33f5
commit
d07f3aae48
1 changed files with 6 additions and 4 deletions
|
@ -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)))))
|
||||
|
|
Loading…
Add table
Reference in a new issue