diff options
author | Rishi <rishi_devan@mail.com> | 2020-07-15 11:51:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-15 11:51:00 (GMT) |
commit | 5a8d121a1f3ef5ad7c105ee378cc79a3eac0c7d4 (patch) | |
tree | 68dffaf58d9509ec482ef1cddd0815fbd5c70fa7 /Lib/tarfile.py | |
parent | bbceef6851895135c80e588a55854c1afab46499 (diff) | |
download | cpython-5a8d121a1f3ef5ad7c105ee378cc79a3eac0c7d4.zip cpython-5a8d121a1f3ef5ad7c105ee378cc79a3eac0c7d4.tar.gz cpython-5a8d121a1f3ef5ad7c105ee378cc79a3eac0c7d4.tar.bz2 |
bpo-39017: Avoid infinite loop in the tarfile module (GH-21454)
Avoid infinite loop when reading specially crafted TAR files using the tarfile module
(CVE-2019-20907).
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-x | Lib/tarfile.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index e2b6053..6769066 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -1249,6 +1249,8 @@ class TarInfo(object): length, keyword = match.groups() length = int(length) + if length == 0: + raise InvalidHeaderError("invalid header") value = buf[match.end(2) + 1:match.start(1) + length - 1] # Normally, we could just use "utf-8" as the encoding and "strict" |