mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
[3.14] gh-132983: Don't allow trailer data in ZstdFile (GH-133736) (#133799)
gh-132983: Don't allow trailer data in ZstdFile (GH-133736)
(cherry picked from commit 50b5370664
)
Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
This commit is contained in:
parent
f6a4604017
commit
99ca086f91
2 changed files with 2 additions and 3 deletions
|
@ -1682,10 +1682,10 @@ class FileTestCase(unittest.TestCase):
|
|||
|
||||
# Trailing data isn't a valid compressed stream
|
||||
with ZstdFile(io.BytesIO(self.FRAME_42 + b'12345')) as f:
|
||||
self.assertEqual(f.read(), self.DECOMPRESSED_42)
|
||||
self.assertRaises(ZstdError, f.read)
|
||||
|
||||
with ZstdFile(io.BytesIO(SKIPPABLE_FRAME + b'12345')) as f:
|
||||
self.assertEqual(f.read(), b'')
|
||||
self.assertRaises(ZstdError, f.read)
|
||||
|
||||
def test_read_truncated(self):
|
||||
# Drop stream epilogue: 4 bytes checksum
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue