From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Rishi Date: Wed, 15 Jul 2020 13:51:00 +0200 Subject: [PATCH] 00351-cve-2019-20907-fix-infinite-loop-in-tarfile.patch 00351 # Avoid infinite loop when reading specially crafted TAR files using the tarfile module (CVE-2019-20907). See: https://bugs.python.org/issue39017 --- Lib/tarfile.py | 2 ++ diff --git a/Lib/tarfile.py b/Lib/tarfile.py index adf91d53823..574a6bb279d 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -1400,6 +1400,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] keyword = keyword.decode("utf8")