INCR/DECR: no 64-bit overflow detection + non-standard non-integer error message #43
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_db#43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
INCR/INCRBY/DECR/DECRBYhave two semantic deviations from Redis:ERR increment or decrement would overflow. hero_db release builds (overflow-checksoff) silently wrap at the i64 boundary.ERR invalid integer value for key 'k': 'abc'instead of Redis'sERR value is not an integer or out of range.Reproduction (vs redis 7.0.15)
Root cause
crates/hero_db/src/db/engine/string.rs:81-100(incrby):let new_value = current + amount;— unchecked add.RedisError::InvalidInteger { key, value }— non-standard message text.Fix
Use
i64::checked_addand return the overflow error onNone; align the parse-error text with Redis (value is not an integer or out of range).Filed from a Redis-compatibility audit (hero_db v0.6.0 @ main
aacaad1). Every finding was cross-validated: the same probe passes on stockredis-server 7.0.15and fails on hero_db, using the Apache Kvrocksgocasesuite (Go) and aredis-py 8.0probe (Python). Root causes verified against the source.