[PR #1159] awc_markers: reject incomplete reads (AWC-MARKERS-SHORT-READ) #1192

Open
opened 2026-11-26 20:20:24 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1159
Author: @Taffyyy-ops
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: fix/awc-markers-short-read


📝 Commits (1)

  • 4f39d9e awc_markers: reject incomplete reads (AWC-MARKERS-SHORT-READ)

📊 Changes

2 files changed (+52 additions, -1 deletions)

View changed files

➕ tests/test_awc_markers_short_read.py (+46 -0)
📝 tools/awc_markers.py (+6 -1)

📄 Description

Item ID: AWC-MARKERS-SHORT-READ

Rejects truncated or short reads in tools/awc_markers.py by raising OSError instead of silently parsing incomplete windows or returning partial counts with exit code 0.

Changes

  • tools/awc_markers.py (iter_banks, _read): Checks that fh.read(WINDOW + 3) returns at least min(WINDOW + 3, size - pos) bytes during bank scanning and that _read(fh, at, size) returns all size bytes, raising descriptive OSError exceptions on short reads.
  • tests/test_awc_markers_short_read.py: Adds synthetic tests verifying OSError on truncated bank scans as well as truncated marker and metadata chunk reads.

Verification

  • AI-assisted; synthetic tests only, no game data (python -I scripts/check_no_game_data.py).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1159 **Author:** [@Taffyyy-ops](https://github.com/Taffyyy-ops) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/awc-markers-short-read` --- ### 📝 Commits (1) - [`4f39d9e`](https://github.com/ubiquitarianism/leonida/commit/4f39d9e6f09676c542536efed8d882ca56b89cda) awc_markers: reject incomplete reads (AWC-MARKERS-SHORT-READ) ### 📊 Changes **2 files changed** (+52 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `tests/test_awc_markers_short_read.py` (+46 -0) 📝 `tools/awc_markers.py` (+6 -1) </details> ### 📄 Description Item ID: `AWC-MARKERS-SHORT-READ` Rejects truncated or short reads in `tools/awc_markers.py` by raising `OSError` instead of silently parsing incomplete windows or returning partial counts with exit code `0`. ### Changes - **`tools/awc_markers.py` (`iter_banks`, `_read`):** Checks that `fh.read(WINDOW + 3)` returns at least `min(WINDOW + 3, size - pos)` bytes during bank scanning and that `_read(fh, at, size)` returns all `size` bytes, raising descriptive `OSError` exceptions on short reads. - **`tests/test_awc_markers_short_read.py`:** Adds synthetic tests verifying `OSError` on truncated bank scans as well as truncated marker and metadata chunk reads. ### Verification - AI-assisted; synthetic tests only, no game data (`python -I scripts/check_no_game_data.py`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1192
No description provided.