diff options
| author | Robert Pluim | 2019-02-26 16:37:09 +0100 |
|---|---|---|
| committer | Robert Pluim | 2019-02-27 17:19:21 +0100 |
| commit | d07f3aae48242ad70e874c2d10fc15b7e1efa4d6 (patch) | |
| tree | e2d0ba749e498e046a09eb0bcfbf1f31126a2164 | |
| parent | 9564fc33f5f0bcad2cb775ed8f597512ef6c0f1d (diff) | |
| download | emacs-d07f3aae48242ad70e874c2d10fc15b7e1efa4d6.tar.gz emacs-d07f3aae48242ad70e874c2d10fc15b7e1efa4d6.zip | |
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)
| -rw-r--r-- | lisp/net/eww.el | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index d37a48126c1..3ec6c1cfd3b 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." | |||
| 470 | (condition-case nil | 470 | (condition-case nil |
| 471 | (decode-coding-region (point) (point-max) encode) | 471 | (decode-coding-region (point) (point-max) encode) |
| 472 | (coding-system-error nil)) | 472 | (coding-system-error nil)) |
| 473 | (save-excursion | 473 | (save-excursion |
| 474 | ;; Remove CRLF before parsing. | 474 | ;; Remove CRLF and NULL before parsing. |
| 475 | (while (re-search-forward "\r$" nil t) | 475 | (while (re-search-forward "\\(\r$\\)\\|\\(\000\\)" nil t) |
| 476 | (replace-match "" t t))) | 476 | (replace-match (if (match-beginning 1) |
| 477 | "" | ||
| 478 | "\\0") t t))) | ||
| 477 | (libxml-parse-html-region (point) (point-max)))))) | 479 | (libxml-parse-html-region (point) (point-max)))))) |
| 478 | (source (and (null document) | 480 | (source (and (null document) |
| 479 | (buffer-substring (point) (point-max))))) | 481 | (buffer-substring (point) (point-max))))) |