Skip to content

fix underflow and crash on malformed stream - #23

Merged
patchzyy merged 1 commit into
mainfrom
Premature-success-fix
Aug 24, 2026
Merged

fix underflow and crash on malformed stream#23
patchzyy merged 1 commit into
mainfrom
Premature-success-fix

Conversation

@patchzyy

@patchzyy patchzyy commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Hardened the decompressor against malformed data
as talked about here #17

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of malformed compressed data during Yaz0 decompression.
    • Prevented invalid memory reads when back-references point outside already decoded data.
    • Added clear error reporting and a fatal prompt when decompression exceeds the output buffer, instead of continuing with invalid results.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: de1f836c-3c1d-4b9d-b247-ba7824a7716a

📥 Commits

Reviewing files that changed from the base of the PR and between 8d5d93f and 9c4f4b7.

📒 Files selected for processing (1)
  • runtime/src/hle/egg_decomp.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The Yaz0 back-reference decoder now validates copy distances against written output. It also aborts on malformed references and output overruns after logging errors and showing fatal popups.

Changes

Yaz0 decompression validation

Layer / File(s) Summary
Decompression error handling
runtime/src/hle/egg_decomp.cpp
The decoder rejects back-references beyond the current output position. It reports malformed streams and output overruns, shows fatal corruption messages, and aborts instead of returning expandSize on overrun.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 9c4f4

This localized decompressor hardening change has no actionable merge-blocking risk remaining based on the available review evidence and is merge-ready after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing underflow and crashes when processing malformed streams.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch Premature-success-fix

Comment @coderabbitai help to get the list of available commands.

@patchzyy
patchzyy merged commit edd03f8 into main Aug 24, 2026
2 checks passed
@patchzyy
patchzyy deleted the Premature-success-fix branch August 24, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant