HINCRBY wraps on int64 overflow and stores the result
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 64/100
Research direction
The bug is in the hash increment path behind the HINCRBY command, which takes a signed 64-bit integer and must reject overflow. Find where that path adds the increment to the stored field value, then check how the result is written back. Add a bounds check that returns Redis's overflow error and leaves the stored field unchanged. Done when HINCRBY at MAX+1 and MIN-1 returns an error and HGET still shows the original value, both verified in the existing hash tests.
Written by the indexing model from the issue text.
Description
Describe the bug
HINCRBY wraps instead of returning an overflow error, and HGET returns the wrapped value.
Steps to reproduce the bug
On a fresh hash:
HSET h f 9223372036854775807 -> 1
HINCRBY h f 1 -> -9223372036854775808
HGET h f -> "-9223372036854775808"
MIN minus 1 also wraps to MAX.
Expected behavior
An overflow error, with the original field value unchanged, as in Redis.
Screenshots
No response
Release version
Garnet main at 44cf0bdb7d36 (reports 2.2.1).
IDE
No response
OS version
Linux arm64, container image ghcr.io/microsoft/garnet:main.
Additional context
No response
- Dominant language
- C#
- Stars
- 12k
- Forks
- 711
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 58
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/garnet
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
Maintainers usually reply within 2 days
-
2.2.1: SAVE fails - main index checkpoint buffer only 512-byte aligned on 4096-sector device (NativeStorageDevice misaligned I/O)Possibly taken @TedHartMS claimed this 1 day ago. Open
microsoft/garnet#2239 · 2 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
SET key value KEEPTTL deletes the key when it has a TTL and the new value does not fit in placePossibly taken @TedHartMS claimed this 4 days ago. Open
microsoft/garnet#2232 · 1 assignee ·
Maintainers usually reply within 2 days
All issues in microsoft/garnet
Similar issues
-
area-signalr
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
dotnet/aspnetcore#69842 · 1 comment ·
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 2/5 Under an hour Newbie friendliness 78/100
microsoft/microsoft-ui-reactor#1373 ·
Maintainers usually reply within 1 day
-
Client customer-reported KeyVault needs-team-attention question Service Attention
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Azure/azure-sdk-for-net#63861 · 3 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
:watch: Not Triaged dotnet-csharp/svc fundamentals/subsvc
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
:watch: Not Triaged Pri3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day