Skip to content

Consume cached nil in Unpacker#skip_nil - #404

Open
OskarEichler wants to merge 1 commit into
msgpack:masterfrom
OskarEichler:audit/consume-skip-nil
Open

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

Conversation

@OskarEichler

Copy link
Copy Markdown

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.

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