awc_markers: reject incomplete reads (AWC-MARKERS-SHORT-READ) #1159
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1159"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-24T19:22:45Z.
Item ID:
AWC-MARKERS-SHORT-READRejects truncated or short reads in
tools/awc_markers.pyby raisingOSErrorinstead of silently parsing incomplete windows or returning partial counts with exit code0.Changes
tools/awc_markers.py(iter_banks,_read): Checks thatfh.read(WINDOW + 3)returns at leastmin(WINDOW + 3, size - pos)bytes during bank scanning and that_read(fh, at, size)returns allsizebytes, raising descriptiveOSErrorexceptions on short reads.tests/test_awc_markers_short_read.py: Adds synthetic tests verifyingOSErroron truncated bank scans as well as truncated marker and metadata chunk reads.Verification
python -I scripts/check_no_game_data.py).Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T19:23:59Z.
Review: APPROVED
Reviewed and verified. Robust error handling for truncated audio streams in tools/awc_markers.py. Explicitly validates buffer lengths against expected window sizes in iter_banks and _read, raising OSError on short read and preventing partial/corrupted scans from completing with exit 0. Verified with tests/test_awc_markers_short_read.py. 100% clean-room.
Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:12:02Z.
Recommendation: [MERGE]
Reasoning:
awc_markersrejects incomplete reads instead of parsing truncated data. Tiny tool hardening with a synthetic test; minimal PR description. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict withmain. Merge once the queued checks are green.Impact level: 2/10
Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-25T10:45:13Z.
@abnalstlll-byte @Deedlyy Thanks for the review and
[MERGE]recommendation! Updated the PR description with a full summary of the short-read checks intools/awc_markers.pyandtests/test_awc_markers_short_read.py.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:35:30Z.
#1159 | head
4f39d9e6f0(merged cleanly with mainadfb3821a2) |python -I tests/test_awc_markers_short_read.py -v+python -I tests/test_awc_markers.py -v| red on main:FAILED (failures=3)(iter_banksand_readaccepted truncated bank-header windows,0xBDmarker chunks, and0x76format metadata without raisingOSError) | green on PR+main:3 ran, OK(test_awc_markers_short_read.py) +15 ran, OK(test_awc_markers.py) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yesAudited
4f39d9e6f0(tools/awc_markers.pyandtests/test_awc_markers_short_read.py) on Windows 11 — first execution of this PR — confirminglen(buf) < min(WINDOW + 3, size - pos)initer_banksand exact-length verification in_readreject truncated streams and preserve existing--outreports on failure, while keepingmusic_framesand archive census behavior intact across all 15test_awc_markers.pycases. Also verifiedtests/test_ci_registration.py,tests/test_text_write_line_endings.py, andscripts/check_no_game_data.py.Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:44:13Z.
RUN for #1159 (red/green, synthetic inputs only, no build, no game, GPU not used)
Heads tested
4f39d9e6f0829530dbd0(origin/main at the time of the run)git merge --no-edit --no-ff(local only, merge was clean, nothing pushed)Commands (one process per file, from the repo root, CPython 3.13.12 with -I)
Red: tests kept, the PR's change to tools/ reverted to the merge base. behavioural: with tools/awc_markers.py reverted, 3 failures (failures=3): "OSError not raised" for the truncated header scan and for the truncated marker and metadata reads.
Green at PR head: yes (tests/test_awc_markers_short_read.py: 3 passed; tests/test_awc_markers.py: exit 0 (plain script, no unittest summary))
Green merged into main: yes, same files all pass on the merged tree (counts as above)
Plain main (other covering tests, without the PR): pass, so nothing pre-existing fails and nothing breaks once merged.
Kind of red: behavioural (test fails for the reason the PR fixes).
Machine: Windows 11 Pro 10.0.26300, CPython 3.13.12; GPU not used.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T08:54:12Z.
@Taffyyy-ops this PR is green on
main+ PR (red/green runs posted above by zmasi and enlight3d). The only thing missing for a merge is your claim of its item in the coordination issue #2570. Once it is there, a maintainer can merge it. (This is a one-time note on each of your green PRs: #1115 #1119 #1124 #1136 #1142 #1159.) — OreoFR's agent (AI-assisted)Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:38:21Z.
Merged at head
4f39d9e. Tested on this head by enlight3d, zmasi: the new test fails on main and passes with the PR (results in the comments above). AI-assisted: yes.