Skip to content

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jun 4, 2019

  • bpo-30835: email: Fix AttributeError when parsing invalid Content-Transfer-Encoding

Parsing an email containing a multipart Content-Type, along with a
Content-Transfer-Encoding containing an invalid (non-ASCII-decodable) byte
will fail. email.feedparser.FeedParser._parsegen() gets the header and
attempts to convert it to lowercase before comparing it with the accepted
encodings, but as the header contains an invalid byte, it's returned as a
Header object rather than a str.

Cast the Content-Transfer-Encoding header to a str to avoid this.

Found using the AFL fuzzer.

Reported-by: Daniel Axtens dja@axtens.net
Signed-off-by: Andrew Donnellan andrew@donnellan.id.au

  • Add email and NEWS entry for the bugfix.
    (cherry picked from commit aa79707)

Co-authored-by: Abhilash Raj maxking@users.noreply.github.com

https://bugs.python.org/issue30835

…GH-13598)

* bpo-30835: email: Fix AttributeError when parsing invalid Content-Transfer-Encoding

Parsing an email containing a multipart Content-Type, along with a
Content-Transfer-Encoding containing an invalid (non-ASCII-decodable) byte
will fail. email.feedparser.FeedParser._parsegen() gets the header and
attempts to convert it to lowercase before comparing it with the accepted
encodings, but as the header contains an invalid byte, it's returned as a
Header object rather than a str.

Cast the Content-Transfer-Encoding header to a str to avoid this.

Found using the AFL fuzzer.

Reported-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Andrew Donnellan <andrew@donnellan.id.au>

* Add email and NEWS entry for the bugfix.
(cherry picked from commit aa79707)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
@miss-islington
Copy link
Contributor Author

@maxking and @warsaw: Status check is done, and it's a success ✅ .

@Mariatta
Copy link
Member

Mariatta commented Jun 4, 2019

Is this considered security fix?

@maxking
Copy link
Contributor

maxking commented Jun 4, 2019

@Mariatta I don't think so, just a bugfix I believe.

@warsaw
Copy link
Member

warsaw commented Jun 4, 2019

Thanks @maxking . Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants