[PR #872] tests: adversarial stress and mutational fuzzing suite for BCPack rANS decompressor #910

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/872
Author: @Tortoche
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: feat/bcpack-bc7-rans


📝 Commits (1)

  • ddaf621 tests: add adversarial stress and mutational fuzzing suite for BCPack rANS decompressor (Phase 1 / Axe 3)

📊 Changes

1 file changed (+448 additions, -0 deletions)

View changed files

➕ tests/test_bcpack_stress.py (+448 -0)

📄 Description

Claimed in the coordination issue as: TEST-BCPACK-STRESS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135088151)

What and why

Adds tests/test_bcpack_stress.py providing adversarial and mutational stress testing for the BCPack rANS texture decompression pipeline:

  • Prefix byte truncation testing: Validates 100% prefix byte truncations across single-fragment and multi-fragment streams for all active codecs (BC1, BC3, BC4, BC5, BC6H, BC7), ensuring clean BcpackError raising without unhandled internal tracebacks or silent corruption.
  • Corrupt header and state transition fuzzing: Validates malformed frequency headers, out-of-order symbol tables, non-canonical state transitions, and virtual zero boundary limits.
  • Block payload bit mutation: Verifies corrupt payloads fail cleanly and safely during block reconstruction.
  • Zero retail game data: All synthetic streams and test fixtures are generated procedurally using the Python standard library.

Tested

  • scripts/check_no_game_data.py tests/test_bcpack_stress.py: 0 violations.
  • python3 -I tests/test_bcpack_stress.py: 20/20 test suites passed in 18.7s with 0 errors.
  • Line endings compliant (newline="\n").

AI-assisted: yes.

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md).
  • Standard library only (runs cleanly with python -I).

🔄 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/872 **Author:** [@Tortoche](https://github.com/Tortoche) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/bcpack-bc7-rans` --- ### 📝 Commits (1) - [`ddaf621`](https://github.com/ubiquitarianism/leonida/commit/ddaf621fffa72d495271446a618095b30f606f27) tests: add adversarial stress and mutational fuzzing suite for BCPack rANS decompressor (Phase 1 / Axe 3) ### 📊 Changes **1 file changed** (+448 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `tests/test_bcpack_stress.py` (+448 -0) </details> ### 📄 Description Claimed in the coordination issue as: TEST-BCPACK-STRESS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135088151) ### What and why Adds `tests/test_bcpack_stress.py` providing adversarial and mutational stress testing for the BCPack rANS texture decompression pipeline: - **Prefix byte truncation testing**: Validates 100% prefix byte truncations across single-fragment and multi-fragment streams for all active codecs (BC1, BC3, BC4, BC5, BC6H, BC7), ensuring clean `BcpackError` raising without unhandled internal tracebacks or silent corruption. - **Corrupt header and state transition fuzzing**: Validates malformed frequency headers, out-of-order symbol tables, non-canonical state transitions, and virtual zero boundary limits. - **Block payload bit mutation**: Verifies corrupt payloads fail cleanly and safely during block reconstruction. - **Zero retail game data**: All synthetic streams and test fixtures are generated procedurally using the Python standard library. ### Tested - `scripts/check_no_game_data.py tests/test_bcpack_stress.py`: 0 violations. - `python3 -I tests/test_bcpack_stress.py`: 20/20 test suites passed in 18.7s with 0 errors. - Line endings compliant (`newline="\n"`). AI-assisted: yes. ### Checklist - [x] Based on current main and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md). - [x] Standard library only (runs cleanly with `python -I`). --- <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#910
No description provided.