Repository navigation
Fix BITFIELD session disposal on empty subcommand list and max-offset GET - #2120
Merged
Vasileios Zois (vazois) merged 2 commits intoSep 10, 2026
Merged
Conversation
… GET Zero-subcommand BITFIELD indexed an empty subcommand list, and BITFIELD GET with offset + encoding == 2^32 called Index past the 2^32-1 bit-offset cap; both threw and disposed the session. Zero-op commands now reply with an empty array instead of crashing.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fixes are correct and include regression coverage for both reported failures.
Pull request overview
Fixes two BITFIELD/BITFIELD_RO crashes while preserving RESP session availability.
Changes:
- Returns an empty array when no executable subcommands are supplied.
- Removes an invalid maximum-offset calculation.
- Adds regression tests for both crash scenarios.
File summaries
| File | Description |
|---|---|
BitmapCommands.cs |
Handles empty subcommand lists safely. |
BitmapManagerBitfield.cs |
Removes the out-of-range unused index calculation. |
GarnetBitmapTests.cs |
Tests empty commands and maximum-offset GET behavior. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Vasileios Zois (vazois)
approved these changes
Sep 9, 2026
Vasileios Zois (vazois)
merged commit Sep 10, 2026
ba5e2eb
into
microsoft:main
328 of 333 checks passed
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.
Two session-killing crashes in BITFIELD/BITFIELD_RO:
A key with no subcommands (
BITFIELD key,BITFIELD key OVERFLOW SAT) indexed an empty subcommand list and disposed the session.Zero-op commands now reply with an empty array, matching Redis's
*0for string and missing keys.BITFIELD GETwithoffset + encoding == 2^32(e.g.GET u1 4294967295) calledIndex(offset + encoding)fromGetValue, which throws past the 2^32-1 bit-offset cap and disposed
the session whenever the bitmap reached the field. The call was
part of an unread local; removed.
Known parity gap: Redis returns WRONGTYPE for zero-op BITFIELD on
non-string keys; Garnet replies
*0.BitFieldMaxOffsetGetAsync allocates a 512 MB bitmap — the smallest
value that reaches the fixed path.