[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#34469: 26.1; EWW stops renderring web page on null byte
From: |
Eli Zaretskii |
Subject: |
bug#34469: 26.1; EWW stops renderring web page on null byte |
Date: |
Tue, 19 Feb 2019 18:30:48 +0200 |
> From: Robert Pluim <rpluim@gmail.com>
> Date: Tue, 19 Feb 2019 11:06:37 +0100
> Cc: 34469@debbugs.gnu.org, Nicholas Drozd <nicholasdrozd@gmail.com>
>
> Glenn Morris <rgm@gnu.org> writes:
>
> > Perhaps eww-display-html should replace null bytes (with whatever the
> > html standard says is appropriate) before calling
> > libxml-parse-html-region. It already replaces CRLF.
>
> Chrome at least just strips the null byte completely.
>
> There is apparently a class of attacks that uses the null character
> for nefarious purposes, so how about something like this:
>
> diff --git a/lisp/net/eww.el b/lisp/net/eww.el
> index 1cc4557ce1..9b57bc43e4 100644
> --- a/lisp/net/eww.el
> +++ b/lisp/net/eww.el
> @@ -448,8 +448,8 @@ eww-display-html
> (decode-coding-region (point) (point-max) encode)
> (coding-system-error nil))
> (save-excursion
> - ;; Remove CRLF before parsing.
> - (while (re-search-forward "\r$" nil t)
> + ;; Remove CRLF and NULL before parsing.
> + (while (re-search-forward "\r$\\|\000" nil t)
> (replace-match "" t t)))
It is un-Emacsy, IMO, to remove content without a trace. (CR is
different: we simply convert text to Unix LF-only EOL format.) So I'd
suggest to replace with "^@" or "\000" or "NUL" or something to that
effect. Even U+FFFD would be better than removing.
(We could get fancy and have a defcustom for those who do want the
null bytes removed.)
Thanks.
- bug#34469: 26.1; EWW stops renderring web page on null byte, Lukasz Pawelczyk, 2019/02/13
- bug#34469: 26.1; EWW stops renderring web page on null byte, Nicholas Drozd, 2019/02/13
- bug#34469: 26.1; EWW stops renderring web page on null byte, Nicholas Drozd, 2019/02/16
- bug#34469: 26.1; EWW stops renderring web page on null byte, Glenn Morris, 2019/02/18
- bug#34469: 26.1; EWW stops renderring web page on null byte, Robert Pluim, 2019/02/19
- bug#34469: 26.1; EWW stops renderring web page on null byte,
Eli Zaretskii <=
- bug#34469: 26.1; EWW stops renderring web page on null byte, Robert Pluim, 2019/02/19
- bug#34469: 26.1; EWW stops renderring web page on null byte, Eli Zaretskii, 2019/02/19
- bug#34469: 26.1; EWW stops renderring web page on null byte, Robert Pluim, 2019/02/20
- bug#34469: 26.1; EWW stops renderring web page on null byte, Robert Pluim, 2019/02/27
- bug#34469: 26.1; EWW stops renderring web page on null byte, Eli Zaretskii, 2019/02/27
- bug#34469: 26.1; EWW stops renderring web page on null byte, Robert Pluim, 2019/02/27
bug#34469: 26.1; EWW stops renderring web page on null byte, Paul Eggert, 2019/02/27