mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
fix: reject zset variadic commands with 0 keys (#2022)
Fixes the assertion failure as reported by #1994. Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
826b1d81a3
commit
bcfd1863c7
4 changed files with 16 additions and 11 deletions
|
@ -1462,12 +1462,10 @@ OpResult<KeyIndex> DetermineKeys(const CommandId* cid, CmdArgList args) {
|
|||
if (!absl::SimpleAtoi(num, &num_custom_keys) || num_custom_keys < 0)
|
||||
return OpStatus::INVALID_INT;
|
||||
|
||||
if (name == "ZDIFF" && num_custom_keys == 0) {
|
||||
return OpStatus::INVALID_INT;
|
||||
}
|
||||
|
||||
if (name == "ZUNION" && num_custom_keys == 0) {
|
||||
return OpStatus::SYNTAX_ERR;
|
||||
if (num_custom_keys == 0 &&
|
||||
(absl::StartsWith(name, "ZDIFF") || absl::StartsWith(name, "ZUNION") ||
|
||||
absl::StartsWith(name, "ZINTER"))) {
|
||||
return OpStatus::AT_LEAST_ONE_KEY;
|
||||
}
|
||||
|
||||
if (args.size() < size_t(num_custom_keys) + num_keys_index + 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue