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
email/message.py [Message.get_content_type]: Trivial regex hangs on pathological input #46928
Comments
[Reported by Alberto Casado Martín [1]] Message.get_content_type() hangs when very large values are split by the paramre comes from line 26: Unless the full fledged parser cited in the comment before line 26 is in [1] http://mail.python.org/pipermail/python-dev/2008-April/078840.html |
Augmented version of Daniel's patch. This makes an internal function that does the same work. It uses I didn't remove the module global "paramre" because an external module Do bugfixes get applied to 2.6 or 3.0? I'm a bit out of practice. |
This should really be fixed. Hanging on a rather normal email message |
Fixed in r65700. Thanks for the report! |
Antoine, I looked at your patch and I'm not sure why you applied it Yours uses str.partition which I pointed out is sub-optimal (same big-Oh If my patch was deficient please let me know. |
Hi Jack,
I added that function so that the header splitting facility is I think the point of the issue is to remove the pathological That said, I've timed the function against the regular expression and Your patch was keeping the regular expression as a module-level constant Regards Antoine. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: