raw[len(MAGIC):len(HEADER)] , Assuming raw is long enough If raw shorter than 5 bytes = incorrect slicing instead of clean error FIX: if len(raw) < len(HEADER): raise ValueError("Truncated header.")
raw[len(MAGIC):len(HEADER)]
, Assuming raw is long enough
If raw shorter than 5 bytes = incorrect slicing instead of clean error
FIX:
if len(raw) < len(HEADER):
raise ValueError("Truncated header.")