Fix SEGV on stack depth underflow in recursive extension unpacking - #405
Merged
byroot merged 1 commit intoSep 3, 2026
Merged
Conversation
A recursive extension proc that rescues an inner read error, or that calls Unpacker#skip, drives stack.depth down to 0 before read_raw_body_begin pops the barrier it pushed. The unconditional pop then underflowed depth to SIZE_MAX and read/wrote out-of-bounds stack entries, crashing the VM. Restore the depth to just below the pushed barrier instead of decrementing unconditionally. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Watson1978
force-pushed
the
fix/recursive-ext-stack-underflow
branch
from
September 3, 2026 01:30
e7e544e to
7ff80ad
Compare
byroot
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A recursive extension proc that rescues an inner read error, or that calls
Unpacker#skip, can leavestack.depthat 0 beforeread_raw_body_beginpops the barrier it pushed. The unconditional pop then underflowed the depth toSIZE_MAXand read/wrote out-of-bounds stack entries, crashing the VM (SIGSEGV). This restores the depth to just below the pushed barrier instead of decrementing unconditionally.Reproduction
Before this change the script crashes with a SIGSEGV; after it, it prints
no crash.🤖 Generated with Claude Code