redis-check-rdb add when_opcode check for module aux (#10859)
In #9199, we add a `goto eoferr` in when_opcode check, this means that if the when_opcode check fails, we will abort the rdb loading, but this not reflected in the rdb-check tool. So someone can modify when_opcode to make rdb load fail, but rdb-check will report OK. Just a cleanup or a code consistency issue. ``` serverLog: # Internal error in RDB reading offset 0, function at rdb.c:3055 -> bad when_opcode [offset 0] Checking RDB file dump.rdb [offset 109] \o/ RDB looks OK! \o/ ``` Plus a minor memory leak fix like #9860, note that it will exit immediately after the eoferr, so it is not strictly a leak, so it is also a small cleanup.
This commit is contained in:
parent
d4595dd94f
commit
0a2f78837d
@ -283,7 +283,10 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) {
|
||||
robj *auxkey, *auxval;
|
||||
rdbstate.doing = RDB_CHECK_DOING_READ_AUX;
|
||||
if ((auxkey = rdbLoadStringObject(&rdb)) == NULL) goto eoferr;
|
||||
if ((auxval = rdbLoadStringObject(&rdb)) == NULL) goto eoferr;
|
||||
if ((auxval = rdbLoadStringObject(&rdb)) == NULL) {
|
||||
decrRefCount(auxkey);
|
||||
goto eoferr;
|
||||
}
|
||||
|
||||
rdbCheckInfo("AUX FIELD %s = '%s'",
|
||||
(char*)auxkey->ptr, (char*)auxval->ptr);
|
||||
@ -297,6 +300,10 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) {
|
||||
if ((moduleid = rdbLoadLen(&rdb,NULL)) == RDB_LENERR) goto eoferr;
|
||||
if ((when_opcode = rdbLoadLen(&rdb,NULL)) == RDB_LENERR) goto eoferr;
|
||||
if ((when = rdbLoadLen(&rdb,NULL)) == RDB_LENERR) goto eoferr;
|
||||
if (when_opcode != RDB_MODULE_OPCODE_UINT) {
|
||||
rdbCheckError("bad when_opcode");
|
||||
goto err;
|
||||
}
|
||||
|
||||
char name[10];
|
||||
moduleTypeNameByID(name,moduleid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user