bpo-39017 Fix infinite loop in the tarfile module#21454
bpo-39017 Fix infinite loop in the tarfile module#21454encukou merged 4 commits intopython:masterfrom
Conversation
Add a check for length = 0 in the _proc_pax function to avoid running into an infinite loop
encukou
left a comment
There was a problem hiding this comment.
Could you note the CVE number that got assigned to this flaw?
| 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() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 <[email protected]>
Replace code that is never called with pass in tarfile testcase
|
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 <[email protected]>
|
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 <[email protected]>
|
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 <[email protected]>
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 <[email protected]>
|
Thank you everyone, for this opportunity |
…GH-21482) 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 <[email protected]> Automerge-Triggered-By: @encukou
…GH-21483) 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 <[email protected]> Automerge-Triggered-By: @encukou
…1484) 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
…#21489) 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 <[email protected]>
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