bink_index: refuse an incomplete embedded stream before probing #2252

Merged
kirigayakazima merged 1 commit from upstream-pr/2252 into main 2026-11-28 19:32:36 +00:00
kirigayakazima commented 2026-11-26 10:24:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-26T10:24:23Z.


Claimed in the coordination issue as: BINK-INDEX-TRUNCATED-PROBE-COPY

What and why

An archive can shrink between indexing and probing. Detect EOF before the indexed byte count has been copied, clean up the temporary stream and report a failed probe. The regression truncates a synthetic archive by one byte and verifies that ffprobe never receives the partial file.

Tested

Windows, Python 3.14.7. The regression failed on the parent commit and passed with this change.

  • python -I tests/test_bink_index.py
  • git diff --check and the changed-path no-game-data scan passed.
  • Shared main baseline: 498 semantic test files, 6,351 tests passed.

GPUs tested: N/A (synthetic CPU tests).

AI-assisted: Yes.

Checklist

  • Based on current main and merges cleanly with the tested base.
  • One topic.
  • No game data, keys or decryption.
  • Translator contract table: N/A.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5508240170 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2252). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-26T10:24:23Z. --- Claimed in the coordination issue as: [BINK-INDEX-TRUNCATED-PROBE-COPY](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7189018014) ### What and why An archive can shrink between indexing and probing. Detect EOF before the indexed byte count has been copied, clean up the temporary stream and report a failed probe. The regression truncates a synthetic archive by one byte and verifies that ffprobe never receives the partial file. ### Tested Windows, Python 3.14.7. The regression failed on the parent commit and passed with this change. - `python -I tests/test_bink_index.py` - `git diff --check` and the changed-path no-game-data scan passed. - Shared main baseline: 498 semantic test files, 6,351 tests passed. GPUs tested: N/A (synthetic CPU tests). AI-assisted: Yes. ### Checklist - [x] Based on current main and merges cleanly with the tested base. - [x] One topic. - [x] No game data, keys or decryption. - Translator contract table: N/A.
lixonik commented 2026-11-26 10:37:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T10:37:17Z.

Review: COMMENTED


Independent native Windows / Python 3.12 check: all 35 test_bink_index.py tests passed. I also compared a synthetic 1.4 MB embedded payload starting at a nonzero offset on main and the PR. Both copy the complete payload byte-for-byte across the 1 MiB read boundary. For two truncated variants, main returned a partial copy and the PR rejected it and left the temporary directory empty. No real media. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6072571456 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2252#pullrequestreview-6072571456). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T10:37:17Z. **Review:** COMMENTED --- Independent native Windows / Python 3.12 check: all 35 `test_bink_index.py` tests passed. I also compared a synthetic 1.4 MB embedded payload starting at a nonzero offset on main and the PR. Both copy the complete payload byte-for-byte across the 1 MiB read boundary. For two truncated variants, main returned a partial copy and the PR rejected it and left the temporary directory empty. No real media. AI-assisted.
DeadlyChirp commented 2026-11-26 10:42:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-26T10:42:24Z.


Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

  • tests/test_bink_index.py: 35 passed, 14 subtests passed (main: 34 passed).

(AI-assisted test run; output checked by hand.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7189724193 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2252#issuecomment-7189724193). Originally posted by [DeadlyChirp](https://github.com/DeadlyChirp) on 2026-11-26T10:42:24Z. --- Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. - `tests/test_bink_index.py`: 35 passed, 14 subtests passed (main: 34 passed). (AI-assisted test run; output checked by hand.)
real-rusher commented 2026-11-26 12:23:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by real-rusher on 2026-11-26T12:23:44Z.


Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_bink_index.py: 35 tests OK. The PR's test file against main's tools/bink_index.py: 1 failure, so the new test fails on main and passes with the change. compileall clean.

Two other open PRs touch tools/bink_index.py (#2221 and #1022). This one merges cleanly with each, and with #2221 merged as well, tests/test_bink_index.py still passes.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7191945650 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2252#issuecomment-7191945650). Originally posted by [real-rusher](https://github.com/real-rusher) on 2026-11-26T12:23:44Z. --- Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_bink_index.py: 35 tests OK. The PR's test file against main's tools/bink_index.py: 1 failure, so the new test fails on main and passes with the change. compileall clean. Two other open PRs touch tools/bink_index.py (#2221 and #1022). This one merges cleanly with each, and with #2221 merged as well, tests/test_bink_index.py still passes. AI-assisted: yes (Claude Code)
tiguan26 commented 2026-11-27 04:35:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-27T04:35:13Z.

Review: APPROVED


Approving a58ea6b4f.

An embedded stream shorter than its declared size is now an error instead of a silently truncated temp file handed to the probe.

Merged onto main d1dff7949 in one batch with 22 other tool PRs of this series (no conflicts), on Linux with Python 3.13. tests/test_bink_index.py: 35 passed (main: 34). AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6083531952 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2252#pullrequestreview-6083531952). Originally posted by [tiguan26](https://github.com/tiguan26) on 2026-11-27T04:35:13Z. **Review:** APPROVED --- Approving a58ea6b4f. An embedded stream shorter than its declared size is now an error instead of a silently truncated temp file handed to the probe. Merged onto `main` `d1dff7949` in one batch with 22 other tool PRs of this series (no conflicts), on Linux with Python 3.13. `tests/test_bink_index.py`: 35 passed (main: 34). AI-assisted (Claude Code, Claude Opus 5.5).
MoonEyes commented 2026-11-28 19:32:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T19:32:33Z.


Red/green: tests/test_bink_index.py fails on main (a truncated embedded stream is still probed as bink2) and passes with the PR merged, on GitHub Actions Linux and natively on Windows.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 7daa4a4a5 in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7244622371 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2252#issuecomment-7244622371). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T19:32:33Z. --- Red/green: tests/test_bink_index.py fails on main (a truncated embedded stream is still probed as bink2) and passes with the PR merged, on GitHub Actions Linux and natively on Windows. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 7daa4a4a5 in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
OreoFR commented 2026-11-28 22:00:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:00:40Z.


Verified by OreoFR

  • Base: main 4a54aedcb + PR head a58ea6b4f
  • Test: python -I tests/test_bink_index.py
  • Red on main: 1 failure (truncated stream probed: decodes=yes)
  • Green with the PR: 39 OK
  • Verdict: READY
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246431739 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2252#issuecomment-7246431739). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T22:00:40Z. --- **Verified by OreoFR** - Base: main `4a54aedcb` + PR head `a58ea6b4f` - Test: `python -I tests/test_bink_index.py` - Red on main: 1 failure (truncated stream probed: decodes=yes) - Green with the PR: 39 OK - Verdict: READY - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!2252
No description provided.