Skip to content

Commit

Permalink
Merge pull request #70 from qiongtubao/fix/command_params_error
Browse files Browse the repository at this point in the history
[fix] Command parameter length is incorrect
  • Loading branch information
qiongtubao authored Feb 4, 2021
2 parents 06d0358 + a51fcb9 commit db6f84b
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 99 deletions.
7 changes: 7 additions & 0 deletions CRDT-RELEASENOTES
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ MODERATE: Program an upgrade of the server, but it's not urgent.
HIGH: There is a critical bug that may affect a subset of users. Upgrade!
CRITICAL: There is a critical bug affecting MOST USERS. Upgrade ASAP.
--------------------------------------------------------------------------------
================================================================================
XRedis-CRDT 1.0.10 Released Thu Feb 4 14:31:37 CST 2021
================================================================================
Upgrade urgency HIGH: Compared with the previous version, there are some improvements, mainly:
Major things:
* [bugfix] redis-server crash when the zrange command uses wrong parameters

================================================================================
XRedis-CRDT 1.0.9 Released Sun Dec 13 23:42:49 CST 2020
================================================================================
Expand Down
8 changes: 8 additions & 0 deletions crdt_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ int sunionDiffGenericCommand(RedisModuleCtx *ctx, RedisModuleString **setkeys, i
target_sets[j] = NULL;
continue;
}
if (RedisModule_ModuleTypeGetType(moduleKey) != CrdtSet) {
if(replyed) {
zfree(target_sets);
return CRDT_ERROR;
}
target_sets[j] = NULL;
continue;
}
CRDT_Set *setobj = getCurrentValue(moduleKey);
if(moduleKey != NULL ) RedisModule_CloseKey(moduleKey);

Expand Down
13 changes: 3 additions & 10 deletions ctrip_crdt_register.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,17 +602,12 @@ int setGenericCommand(RedisModuleCtx *ctx, RedisModuleKey* moduleKey, int flags,
initIncrMeta(&set_meta);
long long expire_time = -2;
if(type == CRDT_RC_TYPE) {
// callback_item = add_rc(moduleKey, &set_meta, RedisModule_GetSds(val));
sds valstr = RedisModule_GetSds(val);
char valbuf[(21 +17 +4)*16 + sdslen(valstr)];
int vallen = add_rc2(ctx, getCurrentValue(moduleKey), getTombstone(moduleKey), &set_meta, key, valstr , valbuf);
callback_item = add_rc(moduleKey, &set_meta, RedisModule_GetSds(val));
expire_time = setExpireByModuleKey(moduleKey, flags, expire, milliseconds, &set_meta);
replicationCrdtRcCommand2(ctx, RedisModule_GetSds(key), &set_meta, valbuf, vallen, expire_time);
// replicationCrdtRcCommand(ctx, RedisModule_GetSds(key), &set_meta, callback_item, expire_time);
// sdsfree(callback_item);
replicationCrdtRcCommand(ctx, RedisModule_GetSds(key), &set_meta, callback_item, expire_time);
sdsfree(callback_item);
} else if(type == CRDT_REGISTER_TYPE) {
callback_item = add_reg(moduleKey, &set_meta, RedisModule_GetSds(val));
// callback_item = add_reg2(ctx, getCurrentValue(moduleKey), getTombstone(moduleKey), &set_meta, key, RedisModule_GetSds(val));
sdsfree(callback_item);
expire_time = setExpireByModuleKey(moduleKey, flags, expire, milliseconds, &set_meta);
replicationCrdtSetCommand(ctx, RedisModule_GetSds(key), RedisModule_GetSds(val), &set_meta, expire_time);
Expand Down Expand Up @@ -660,8 +655,6 @@ int psetexCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
* crdt.rc when value is int or float
*/



int setCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
if (argc < 3) return RedisModule_WrongArity(ctx);
RedisModuleString* expire = NULL;
Expand Down
Loading

0 comments on commit db6f84b

Please sign in to comment.