jsumners / jsumners/feedparser

base64 decoding is too aggressive

Open
#284 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-migrated
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

What steps will reproduce the problem?
1. Open the following example file: 
https://gist.github.com/1019783#file_zotero.xml using Python 2.7
2. Parse using feedparser.parse()
3. Attempt to decode the content[0]['value'] strings to UTF-8

What is the expected output? What do you see instead?
The second entry should be '{"name":"A Midsummer Night's Dream, "parent":false}'
Instead, a UnicodeDecodeError is thrown:
'ascii', 
'\x9d\xa9\x9e\x00\xc8\x9d\xb2\xe9\xa6z\xb3b\x82\x1bl\x0e\xb7\x9a\x9a\x96\xabz{_j
[\x1e', 0, 1, 'ordinal not in range(128)'

What version of the product are you using? On what operating system?
Version 5.0.1, OS X (10.6.7), Python 2.7


Please provide any additional information below.


Original issue reported on code.google.com by ursch...@gmail.com on 11 Jun 2011 at 5:22

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with the linked zotero.xml example on Python 2.7 and feedparser.parse(), then trace where the content[0]['value'] string is base64-decoded. Done means the second entry produces the expected JSON-like value and does not raise the reported UnicodeDecodeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.