`ZDIFFSTORE` and `ZINTERSTORE` with numkeys 0 crash the server (SIGSEGV)
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start with CommandZDiffStore::Parse and CommandZUnionStore::Parse in src/commands/cmd_zset.cc, then compare their numkeys validation with CommandZDiff::Parse and CommandZInter. Add coverage for zero numkeys to the relevant command tests and confirm both store commands return errors without crashing. Pull request #3731 is already open for this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Search before asking
- I had searched in the issues and found no similar issues.
Version
Kvrocks 2.17.0 (commit 185d4221), Docker image apache/kvrocks:2.17.0 (same as latest), Linux
x86_64. The code involved is unchanged on unstable.
Minimal reproduce step
docker run -d --name kvrocks -p 6666:6666 apache/kvrocks:2.17.0
redis-cli -p 6666 ZADD s 1 a
redis-cli -p 6666 ZDIFFSTORE dst 0 s # server crashes
redis-cli -p 6666 ZINTERSTORE dst 0 AGGREGATE SUM # same, after the restart
What did you expect to see?
An error reply. The read-only commands already reject numkeys 0 (ZDIFF 0 s answers
ERR value is out of range, must be positive, ZINTER 0 s answers ERR out of numeric range),
and Redis answers ERR at least 1 input key is needed for 'zdiffstore' command.
What did you see instead?
The server process dies and every client loses its connection:
Ooops! Apache Kvrocks version 2.17.0 (commit 185d4221) got signal: Segmentation fault (11)
#2 ComposeNamespaceKey(rocksdb::Slice const&, rocksdb::Slice const&, bool)
#3 redis::Database::AppendNamespacePrefix(rocksdb::Slice const&)
#4 redis::ZSet::RangeByScore(...)
#5 redis::ZSet::Diff(...)
#6 redis::ZSet::DiffStore(...)
#7 redis::CommandZDiffStore::Execute(...)
Anything Else?
Potential cause. CommandZDiffStore::Parse (src/commands/cmd_zset.cc:1524-1538) and
CommandZUnionStore::Parse (:1200-1216, which ZINTERSTORE inherits) accept numkeys 0 and leave
the key list empty. ZSet::Diff then reads keys[0] (src/types/redis_zset.cc:905) and
ZSet::Inter reads keys_weights[0] (:657).
Suggested fix. Reject numkeys below 1 in both parsers, as CommandZDiff::Parse (:1472) and
CommandZInter (:1127) already do.
Are you willing to submit a PR?
- I'm willing to submit a PR!
- Lenguaje dominante
- C++
- Estrellas
- 4.5k
- Forks
- 689
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 36
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/kvrocks
-
HSETEXPIRE with an overflowing TTL returns OK and deletes the whole hashPosiblemente ocupada @anubhavgupta121 la tomó hace 22 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
LPOS with COUNT replies with bulk strings instead of integersPosiblemente ocupada @DeviousDrops la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Add docker build for alpine 3.24Posiblemente ocupada @aleksraiden la tomó hace 1 día. Abiertoenhancement
apache/kvrocks#3768 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
`JSON.STRAPPEND` with non JSON value crashes the serverPosiblemente ocupada @ggyuchive la tomó hace 2 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
apache/kvrocks#3765 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
A blocked client that is woken but loses the element to another client is never woken againPosiblemente ocupada @ggyuchive la tomó hace 3 días. Abiertobug
Dificultad 4/5 1-2 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
Todos los issues de apache/kvrocks
Issues similares
-
area:qmc bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
Los mantenedores suelen responder en 3 días
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
ASGC-Game-Jam/asgc-gamejam-2026#563 ·
Los mantenedores suelen responder en 1 día
-
area/ysql kind/bug priority/medium status/awaiting-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
yugabyte/yugabyte-db#37523 ·
Los mantenedores suelen responder en 1 día
-
Let agents name their jobsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Cockatrice/Cockatrice#7896 ·
Los mantenedores suelen responder en 1 día