Skip to content

fix(nbt): cap skim recursion depth to reject hostile region files - #1

Merged
dekrom merged 1 commit into
dekrom:mainfrom
terbin:fix-nbt-recursion
Aug 28, 2026
Merged

dekrom merged 1 commit into
dekrom:mainfrom
terbin:fix-nbt-recursion

Conversation

@terbin

@terbin terbin commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

A crafted region can nest NBT tags deeply enough to overflow the stack while the map skims block-state names, which aborts the process. The decoder runs on untrusted ingest input, so the crash is remotely reachable. The skim is now bounded to a fixed recursion depth and anything deeper is treated as corrupt.

A region file can nest NBT tags deeply enough to overflow the stack while the map skims block-state names, which aborts the whole process. The region decoder runs on untrusted input from map ingest, so the crash is remotely reachable. Bound the skim to a fixed recursion depth and treat anything deeper as corrupt.

@dekrom dekrom left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the crash reproduces on main (deeply-nested NBT in an ingested region overflows the stack and aborts the process) and that this cap rejects it cleanly. The skim is the only recursive path in the codec and both entry points are bounded. Thanks for catching this.

@dekrom
dekrom merged commit 5cfc771 into dekrom:main Aug 28, 2026
@terbin
terbin deleted the fix-nbt-recursion branch August 28, 2026 09:08
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.

2 participants