-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-37764: Fix infinite loop when parsing unstructured email headers. #15239
Merged
Merged
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fd5a82a
bpo-37764: fix hang case in get_unstructured
epicfaace 0baad95
fix: rename variable
epicfaace b7874bc
fix: parse unstructured word correctly, fix 1st bug
epicfaace 364c549
fix: handle invalid encoded word
epicfaace c55361e
fix format
epicfaace 2d5966f
fix typo
epicfaace 5a84182
update test
epicfaace 7155ac5
format for pep8
epicfaace eca9a64
rename to valid_ew
epicfaace 18cef4c
add infinite loop comments
epicfaace 941da1c
rename to InvalidEwError
epicfaace 6f9da90
add tests for message_from_string
epicfaace 15bcc80
Update Lib/test/test_email/test__header_value_parser.py
epicfaace 7911dee
📜🤖 Added by blurb_it.
blurb-it[bot] 18564f7
Update ACKS
epicfaace d012305
fix: use internal class _InvalidEwError
epicfaace 915fef3
Merge branch 'issue37764' of github.com:epicfaace/cpython into issue3…
epicfaace File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Security/2019-08-27-01-13-05.bpo-37764.qv67PQ.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fixes email._header_value_parser.get_unstructured going into an infinite loop for a specific case in which the email header does not have trailing whitespace, and the case in which it contains an invalid encoded word. Patch by Ashwin Ramaswami. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this exception out of
errors.py
and into this module as_InvalidEwError
(and then it also probably doesn't need to inherit fromHeaderParseError
). It's just an internal implementation exception, so let's not expose it, even if it's not in__all__
or documented.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I've kept it inheriting from
HeaderParseError
, though, because there are some tests that rely on aHeaderParseError
to be raised (when an_InvalidEwError
is actually raised) and it didn't seem right to have a test that tests to see if an internal implementation exception is raised.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree the inheriting from
HeaderParseError
makes sense because of the way it is used internally as both an implementation detail and an external error.