Skip to content

Commit

Permalink
allow Format 1 Setup Record to be 134,217,728 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeiger99 committed Feb 10, 2023
1 parent 39aeb7c commit cd2f6c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions chapter10/computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class ComputerF1(packet.Packet):
u1 format
p22''')

_MAX_PACKET_BYTES = 134_217_728

def __init__(self, *args, **kwargs):
packet.Packet.__init__(self, *args, **kwargs)
if self.buffer:
Expand Down
4 changes: 3 additions & 1 deletion chapter10/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class Packet:

csdw_format = BitFormat('u32 csdw')

_MAX_PACKET_BYTES = 524288

def __init__(self, file=None, parent=None, **kwargs):

self.parent = parent
Expand Down Expand Up @@ -199,7 +201,7 @@ def validate(self, silent=False):
elif self.secondary_header:
if self.secondary_sums != self.secondary_checksum:
err = InvalidPacket('Secondary header checksum mismatch!')
if self.data_length > 524288:
if self.data_length > self._MAX_PACKET_BYTES:
err = InvalidPacket(
f'Data length {self.data_length} larger than allowed!')

Expand Down

0 comments on commit cd2f6c6

Please sign in to comment.