[proxy] github.com← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light
/ cpython Public

Conversation

Copy link

mtorromeo commented Nov 30, 2017

With some malformed email address list, the parser for email groups raises an IndexError instead of the correct HeaderParseError.

This results in a complete failure to parse the email while it is still preferable to just ignore the malformed header.

An example of such a malformed list is this:
To: :Foo <foo@example.com> <bar@example.com>

https://bugs.python.org/issue32178

With some malformed email address list, the parser for email groups raises an `IndexError` instead of the correct `HeaderParseError`.

This results in a complete failure to parse the email while it is still preferable to just ignore the malformed header.

An example of such a malformed list is this:
`To: :Foo <foo@example.com> <bar@example.com>`
mtorromeo requested a review from a team as a code owner November 30, 2017 10:39
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

mtorromeo changed the title Fix IndexError on invalid email group header parsing bpo-32178: Fix IndexError on invalid email group header parsing Nov 30, 2017
Copy link
Contributor

maxking commented Jun 14, 2019

Thanks @mtorromeo !

This was fixed as a part of some other pull request, I am not sure which one. But I see the code has been changed to:

    if not value:
        group.defects.append(errors.InvalidHeaderDefect(
            "end of header in group"))
    elif value[0] != ';':
        raise errors.HeaderParseError(
            "expected ';' at end of group but found {}".format(value))

Can you please confirm that is the case?

Copy link
Author

I moved my project to rust so I don't have a piece of code ready to test this nor do I need this fixed anymore, but I guess that change should have indeed fixed the bug.

csabella closed this Jul 3, 2019
Copy link
Contributor

csabella commented Jul 3, 2019

Closing since this issue seems to have been fixed by another pull request at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants