From: Lars Magne Ingebrigtsen <larsi@gnus.org>
Date: Sun, 20 Mar 2016 12:57:11 +0000 (+0100)
Subject: Ignore invalid base64 encoded embedded images
X-Git-Tag: emacs-25.0.93~89^2~39
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d8b2ce5f8a6a849e55b48699dfa0e769a4b9a3f6;p=emacs.git

Ignore invalid base64 encoded embedded images

* lisp/net/shr.el (shr-image-from-data): Ignore invalid base64
encoded embedded images (bug#22928).
(cherry picked from commit f2da80d0e1ccd121c4891e869a45aeb9c6b1795d)

Backport:
---

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 900b8ec3f5c..07fcbebce08 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -924,7 +924,8 @@ If EXTERNAL, browse the URL using `shr-external-browser'."
     (let ((param (match-string 4 data))
 	  (payload (url-unhex-string (match-string 5 data))))
       (when (string-match "^.*\\(;[ \t]*base64\\)$" param)
-	(setq payload (base64-decode-string payload)))
+	(setq payload (ignore-errors
+                        (base64-decode-string payload))))
       payload)))
 
 ;; Behind display-graphic-p test.