]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-98433: Fix quadratic time idna decoding. (#99092)
authorGregory P. Smith <greg@krypto.org>
Tue, 8 Nov 2022 00:54:41 +0000 (16:54 -0800)
committerGitHub <noreply@github.com>
Tue, 8 Nov 2022 00:54:41 +0000 (16:54 -0800)
commitd315722564927c7202dd6e111dc79eaf14240b0d
tree328a7944a0194dfb3cff8cd6433eb69ff7e4e518
parent9430d27355c9f7d386abdac30d688dd6b68bb067
gh-98433: Fix quadratic time idna decoding. (#99092)

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.
Lib/encodings/idna.py
Lib/test/test_codecs.py
Misc/NEWS.d/next/Security/2022-11-04-09-29-36.gh-issue-98433.l76c5G.rst [new file with mode: 0644]