Skip to content

Consume cached nil in Unpacker#skip_nil - #404

Merged
byroot merged 1 commit into
msgpack:masterfrom
OskarEichler:audit/consume-skip-nil
Aug 30, 2026
Merged

Consume cached nil in Unpacker#skip_nil#404
byroot merged 1 commit into
msgpack:masterfrom
OskarEichler:audit/consume-skip-nil

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary

Consume the cached nil marker when Unpacker#skip_nil succeeds. The current native implementation returns true without resetting the cached head byte, so the next read returns the same nil instead of the following object.

Reproduction

Feeding packed nil followed by packed 1, then calling skip_nil and read, returns nil on current master. This branch returns 1.

Verification

  • 458 examples, 0 failures, 1 existing pending example
  • focused before/after model on source and the freshly installed native gem
  • MRI native build, Ruby syntax, exact package/install, Rails 8.1.3.1 boot, and Bootsnap round-trip

The source change and this contribution were prepared with AI assistance and manually reviewed.

Co-Authored-By: Jean Boussier <jean.boussier@gmail.com>
@byroot
byroot force-pushed the audit/consume-skip-nil branch from 0071785 to 512b587 Compare August 30, 2026 06:31
@byroot
byroot merged commit 663c3a3 into msgpack:master Aug 30, 2026
19 checks passed
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