diff options
| author | bobcatchris <83428450+bobcatchris@users.noreply.github.com> | 2026-11-21 23:33:53 -0600 |
|---|---|---|
| committer | bobcatchris <83428450+bobcatchris@users.noreply.github.com> | 2026-11-21 23:58:05 -0600 |
| commit | f76fc2c9c5c3f1a2be688570fcee2a83fab243d9 (patch) | |
| tree | c01eb3246277aee7ff36555c42b128f4ec039011 /runtime/src | |
| parent | 43d470316ec6cbcd64002bc3792998d9f5745dac (diff) | |
saves: reject a truncated or lying ASAV header with a message, not a struct.error
parse_asav read the fixed fields at absolute offsets (timestamp at 0x20, the
checksum at 0x160, the size at 0x168) without checking the file was long enough,
and asav_payload sliced at a declared payload offset that could be past the end.
A truncated save aborted the parser with "unpack_from requires a buffer of at
least 32 bytes", which says nothing about the save, and a lying offset returned
an empty payload as if the file were fine.
Validate both and raise ValueError with the same shape as the JSAV parser
(#923): "header is only N bytes, an ASAV header is 368", and "payload offset
0x... is past the end of a N-byte file". The CLI line that turns this into one
ERROR and exit 2 is #923's guard; this is the parser half of #980.
Tests: three cases in tests/test_saves.py, including the byte counts from the
issue's reproduction.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Diffstat (limited to 'runtime/src')
0 files changed, 0 insertions, 0 deletions