GNU bug report logs - #34469
26.1; EWW stops renderring web page on null byte

Previous Next

Package: emacs;

Reported by: Lukasz Pawelczyk <l.pawelczyk <at> samsung.com>

Date: Wed, 13 Feb 2019 15:57:02 UTC

Severity: normal

Tags: fixed

Found in version 26.1

Fixed in version 27.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 34469 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34469 <at> debbugs.gnu.org, nicholasdrozd <at> gmail.com
Subject: Re: bug#34469: 26.1; EWW stops renderring web page on null byte
Date: Wed, 20 Feb 2019 19:48:50 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Robert Pluim <rpluim <at> gmail.com>
>> Cc: 34469 <at> debbugs.gnu.org,  nicholasdrozd <at> gmail.com
>> Date: Tue, 19 Feb 2019 18:37:26 +0100
>> 
>> Since this is all due to a C-ism in the handling of content, Iʼd vote
>> for "\0", although this is inside Emacs, so perhaps "^@" is best.
>
> Either is fine with me.

Since the web page that triggered this was showing C code, Iʼve gone
for the "\0" option.

2019-02-20  Robert Pluim  <rpluim <at> gmail.com>

	* lisp/net/eww.el (eww-display-html): Replace NULL characters with
	"\0", as libxml can't handle embedded NULLs.
diff --git i/lisp/net/eww.el w/lisp/net/eww.el
index 555b3bd591..06075b1ebd 100644
--- i/lisp/net/eww.el
+++ w/lisp/net/eww.el
@@ -462,10 +462,12 @@ eww-display-html
 		(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)))))




This bug report was last modified 6 years and 80 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.