gh-98433: Fix quadratic time idna decoding. by gpshead · Pull Request #99092 · python/cpython

added 2 commits

November 4, 2022 09:29
There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

An early length check would still be a good idea given that DNS IDNA
label names cannot be more than 63 ASCII characters.

gpshead

@gpshead gpshead marked this pull request as ready for review

November 4, 2022 10:33

@gpshead

@gpshead

@gpshead

@gpshead

@gpshead

gpshead

vstinner

@gpshead

vstinner

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Nov 8, 2022
There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

This also adds an early length check in IDNA decoding to outright reject
huge inputs early on given the ultimate result is defined to be 63 or fewer
characters.
(cherry picked from commit d315722)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

@gpshead gpshead deleted the security/idna_dos_mitigation branch

November 8, 2022 01:21

gpshead added a commit that referenced this pull request

Nov 8, 2022
There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit d315722)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

miss-islington added a commit to miss-islington/cpython that referenced this pull request

Nov 8, 2022
) (pythonGH-99222)

There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit d315722)

(cherry picked from commit a6f6c3a)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>

miss-islington added a commit to miss-islington/cpython that referenced this pull request

Nov 8, 2022
) (pythonGH-99222)

There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit d315722)

(cherry picked from commit a6f6c3a)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>

miss-islington added a commit to miss-islington/cpython that referenced this pull request

Nov 8, 2022
) (pythonGH-99222)

There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit d315722)

(cherry picked from commit a6f6c3a)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>

ned-deily pushed a commit that referenced this pull request

Nov 8, 2022
There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit a6f6c3a)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>

miss-islington added a commit that referenced this pull request

Nov 8, 2022
There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit d315722)

(cherry picked from commit a6f6c3a)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>

ambv pushed a commit that referenced this pull request

Nov 10, 2022
… (GH-99231)

There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit d315722)
(cherry picked from commit a6f6c3a)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>

ambv pushed a commit that referenced this pull request

Nov 10, 2022
… (#99230)

There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit d315722)
(cherry picked from commit a6f6c3a)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>