mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-18 06:03:44 +08:00
reject incomplete model buffers (#38852)
This commit is contained in:
@@ -41,7 +41,8 @@ def load_oob(f):
|
||||
def buffers():
|
||||
while (h := f.read(8)):
|
||||
pb = pickle.PickleBuffer(bytearray(struct.unpack('<q', h)[0]))
|
||||
f.readinto(pb)
|
||||
if f.readinto(pb) != pb.raw().nbytes:
|
||||
raise EOFError("incomplete model buffer")
|
||||
yield pb
|
||||
return pickle.load(io.BytesIO(opcodes), buffers=buffers())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user