Skip to content

Commit 160ac27

Browse files
authored
Merge pull request #19 from kaitai-io/patch-readbytes
read_bytes min amount is 0
2 parents 2ed27c1 + 9faa872 commit 160ac27

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kaitaistruct.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ def read_bits_int(self, n):
239239
# ========================================================================
240240

241241
def read_bytes(self, n):
242+
if n < 0:
243+
raise ValueError(
244+
"requested invalid %d amount of bytes" %
245+
(n,)
246+
)
242247
r = self._io.read(n)
243248
if len(r) < n:
244249
raise EOFError(

0 commit comments

Comments
 (0)