summaryrefslogtreecommitdiffstats
path: root/Lib/encodings
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2020-02-25 03:19:03 (GMT)
committerGitHub <noreply@github.com>2020-02-25 03:19:03 (GMT)
commitba22e8f174309979d90047c5dc64fcb63bc2c32e (patch)
treefe5add86cf54ab65ba7fdc1cc48bc23685884835 /Lib/encodings
parent8af4712a16e4b7d1b60f1faec13cd7a88da95f6a (diff)
downloadcpython-ba22e8f174309979d90047c5dc64fcb63bc2c32e.zip
cpython-ba22e8f174309979d90047c5dc64fcb63bc2c32e.tar.gz
cpython-ba22e8f174309979d90047c5dc64fcb63bc2c32e.tar.bz2
bpo-30566: Fix IndexError when using punycode codec (GH-18632)
Trying to decode an invalid string with the punycode codec shoud raise UnicodeError.
Diffstat (limited to 'Lib/encodings')
-rw-r--r--Lib/encodings/punycode.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/encodings/punycode.py b/Lib/encodings/punycode.py
index 66c5101..1c57264 100644
--- a/Lib/encodings/punycode.py
+++ b/Lib/encodings/punycode.py
@@ -143,7 +143,7 @@ def decode_generalized_number(extended, extpos, bias, errors):
digit = char - 22 # 0x30-26
elif errors == "strict":
raise UnicodeError("Invalid extended code point '%s'"
- % extended[extpos])
+ % extended[extpos-1])
else:
return extpos, None
t = T(j, bias)