mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-132983: Don't allow trailer data in ZstdFile (#133736)
This commit is contained in:
parent
c896dae029
commit
50b5370664
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