From 36c3b7fb3e8015ec61fcb3498462361229023dbc Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Sun, 13 Jun 2021 11:02:03 -0500 Subject: [PATCH] Prevent UnicodeDecodeError when attempting to base64-decode the entry title Fixes #277 --- NEWS | 4 ++++ feedparser/mixin.py | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index e4caab81..de089efa 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ coming in the next release: +6.0.4 - 13 June 2021 + * Prevent a UnicodeDecodeError crash that may occur when + the title element's type attribute exists but is empty. (#277) + 6.0.3 - 12 June 2021 * Fix an issue with the HTTP request status on Python >= 3.9. diff --git a/feedparser/mixin.py b/feedparser/mixin.py index 5f5c8607..49db2be8 100644 --- a/feedparser/mixin.py +++ b/feedparser/mixin.py @@ -506,9 +506,7 @@ def pop(self, element, strip_whitespace=1): if base64 and self.contentparams.get('base64', 0): try: output = base64.decodebytes(output.encode('utf8')).decode('utf8') - except binascii.Error: - pass - except binascii.Incomplete: + except (binascii.Error, binascii.Incomplete, UnicodeDecodeError): pass # resolve relative URIs