Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
[3.11] gh-98433: Fix quadratic time idna decoding. (GH-99092)#99222
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was an unnecessary quadratic loop in idna decoding. This restoresthe behavior to linear.This also adds an early length check in IDNA decoding to outright rejecthuge inputs early on given the ultimate result is defined to be 63 or fewercharacters.(cherry picked from commitd315722)Co-authored-by: Gregory P. Smith <greg@krypto.org>
While I don't think anyone should have reasonable code depending onunbounded strings full of Nothing characters to silently be removedduring idna decoding... this is the conservative choice for a bugfixbackport.
I went with the conservative choice of not adding the upfront length check in the backports. The quadratic algorithm fix remains. Manually inspecting Lib/encoding/punycode.py codec implementation, that looked to me like an O(NlogN) algorithm at worse for decoding, so not really a denial of service concern itself. If anyone disagrees, feel free to open a new issue with a demonstration. |
i'm using the no-not-merge label to prevent automerge so i can manually edit the commit message. |
Thanks@miss-islington for the PR, and@gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8, 3.9, 3.10. |
bedevere-bot commentedNov 8, 2022
GH-99229 is a backport of this pull request to the3.10 branch. |
bedevere-bot commentedNov 8, 2022
GH-99230 is a backport of this pull request to the3.9 branch. |
) (pythonGH-99222)There was an unnecessary quadratic loop in idna decoding. This restoresthe behavior to linear.(cherry picked from commitd315722)(cherry picked from commita6f6c3a)Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>Co-authored-by: Gregory P. Smith <greg@krypto.org>
bedevere-bot commentedNov 8, 2022
GH-99231 is a backport of this pull request to the3.8 branch. |
bedevere-bot commentedNov 8, 2022
GH-99232 is a backport of this pull request to the3.7 branch. |
) (pythonGH-99222)There was an unnecessary quadratic loop in idna decoding. This restoresthe behavior to linear.(cherry picked from commitd315722)(cherry picked from commita6f6c3a)Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>Co-authored-by: Gregory P. Smith <greg@krypto.org>
bedevere-bot commentedNov 8, 2022
GH-99229 is a backport of this pull request to the3.10 branch. |
bedevere-bot commentedNov 8, 2022
GH-99230 is a backport of this pull request to the3.9 branch. |
) (pythonGH-99222)There was an unnecessary quadratic loop in idna decoding. This restoresthe behavior to linear.(cherry picked from commitd315722)(cherry picked from commita6f6c3a)Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>Co-authored-by: Gregory P. Smith <greg@krypto.org>
bedevere-bot commentedNov 8, 2022
GH-99231 is a backport of this pull request to the3.8 branch. |
bedevere-bot commentedNov 8, 2022
GH-99232 is a backport of this pull request to the3.7 branch. |
… (GH-99231)There was an unnecessary quadratic loop in idna decoding. This restoresthe behavior to linear.(cherry picked from commitd315722)(cherry picked from commita6f6c3a)Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>Co-authored-by: Gregory P. Smith <greg@krypto.org>
… (#99230)There was an unnecessary quadratic loop in idna decoding. This restoresthe behavior to linear.(cherry picked from commitd315722)(cherry picked from commita6f6c3a)Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>Co-authored-by: Gregory P. Smith <greg@krypto.org>
Uh oh!
There was an error while loading.Please reload this page.
There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.
(cherry picked from commitd315722)
Co-authored-by: Gregory P. Smithgreg@krypto.org