Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
bpo-39017 Fix infinite loop in the tarfile module #21454
Conversation
Add a check for length = 0 in the _proc_pax function to avoid running into an infinite loop
Could you note the CVE number that got assigned to this flaw? |
Misc/NEWS.d/next/Library/2020-07-12-22-16-58.bpo-39017.x3Cg-9.rst
Outdated
Show resolved
Hide resolved
def test_length_zero_header(self): | ||
with self.assertRaisesRegex(tarfile.ReadError, "file could not be opened successfully"): | ||
with tarfile.open(support.findfile('recursion.tar')) as tar: | ||
tar.getmembers() |
bcaller
Jul 14, 2020
Contributor
I think this tar.getmembers()
can be replaced with pass
since it should never be called. Or you can call tarfile.is_tarfile
instead of with tarfile.open...
. Feel free to ignore this comment.
rishi93
Jul 14, 2020
Author
Contributor
Thank you for the comment, I replaced the tar.getmembers()
with pass
as you suggested
Add relevant CVE number in inline comments Co-authored-by: Petr Viktorin <encukou@gmail.com>
Replace code that is never called with pass in tarfile testcase
5a8d121
into
python:master
Thank you! |
Avoid infinite loop when reading specially crafted TAR files using the tarfile module (CVE-2019-20907). (cherry picked from commit 5a8d121) Co-authored-by: Rishi <rishi_devan@mail.com>
GH-21482 is a backport of this pull request to the 3.9 branch. |
Avoid infinite loop when reading specially crafted TAR files using the tarfile module (CVE-2019-20907). (cherry picked from commit 5a8d121) Co-authored-by: Rishi <rishi_devan@mail.com>
GH-21483 is a backport of this pull request to the 3.8 branch. |
GH-21484 is a backport of this pull request to the 3.7 branch. |
GH-21485 is a backport of this pull request to the 3.6 branch. |
Avoid infinite loop when reading specially crafted TAR files using the tarfile module (CVE-2019-20907). (cherry picked from commit 5a8d121) Co-authored-by: Rishi <rishi_devan@mail.com>
Avoid infinite loop when reading specially crafted TAR files using the tarfile module (CVE-2019-20907). (cherry picked from commit 5a8d121) Co-authored-by: Rishi <rishi_devan@mail.com>
Thank you everyone, for this opportunity |
Avoid infinite loop when reading specially crafted TAR files using the tarfile module (CVE-2019-20907).
Avoid infinite loop when reading specially crafted TAR files using the tarfile module (CVE-2019-20907).
Avoid infinite loop when reading specially crafted TAR files using the tarfile module (CVE-2019-20907).
Avoid infinite loop when reading specially crafted TAR files using the tarfile module (CVE-2019-20907).
Add a check for length = 0 in the _proc_pax function to avoid running into an infinite loop
https://bugs.python.org/issue39017