Skip to content

Commit 50b5370

Browse files
authored
gh-132983: Don't allow trailer data in ZstdFile (#133736)
1 parent c896dae commit 50b5370

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Lib/compression/zstd/_zstdfile.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def __init__(self, file, /, mode="r", *,
8989
raw = _streams.DecompressReader(
9090
self._fp,
9191
ZstdDecompressor,
92-
trailing_error=ZstdError,
9392
zstd_dict=zstd_dict,
9493
options=options,
9594
)

Lib/test/test_zstd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,10 +1682,10 @@ def test_read_incomplete(self):
16821682

16831683
# Trailing data isn't a valid compressed stream
16841684
with ZstdFile(io.BytesIO(self.FRAME_42 + b'12345')) as f:
1685-
self.assertEqual(f.read(), self.DECOMPRESSED_42)
1685+
self.assertRaises(ZstdError, f.read)
16861686

16871687
with ZstdFile(io.BytesIO(SKIPPABLE_FRAME + b'12345')) as f:
1688-
self.assertEqual(f.read(), b'')
1688+
self.assertRaises(ZstdError, f.read)
16891689

16901690
def test_read_truncated(self):
16911691
# Drop stream epilogue: 4 bytes checksum

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy