Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

HINCRBY wraps on int64 overflow and stores the result

Open Beginner friendly
#2,243 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
64/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
databases

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/garnet

All issues in microsoft/garnet

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.