This function is called by rdbLoadObject() when the code is in RDB-check * mode and we find a module value of type 2 that can be parsed without * the need of the actual module. The value is parsed for errors, finally * a dummy redis object is returned just to conform to the API. */
| 1486 | * the need of the actual module. The value is parsed for errors, finally |
| 1487 | * a dummy redis object is returned just to conform to the API. */ |
| 1488 | robj *rdbLoadCheckModuleValue(rio *rdb, char *modulename) { |
| 1489 | uint64_t opcode; |
| 1490 | while((opcode = rdbLoadLen(rdb,NULL)) != RDB_MODULE_OPCODE_EOF) { |
| 1491 | if (opcode == RDB_MODULE_OPCODE_SINT || |
| 1492 | opcode == RDB_MODULE_OPCODE_UINT) |
| 1493 | { |
| 1494 | uint64_t len; |
| 1495 | if (rdbLoadLenByRef(rdb,NULL,&len) == -1) { |
| 1496 | rdbReportCorruptRDB( |
| 1497 | "Error reading integer from module %s value", modulename); |
| 1498 | } |
| 1499 | } else if (opcode == RDB_MODULE_OPCODE_STRING) { |
| 1500 | robj *o = rdbGenericLoadStringObject(rdb,RDB_LOAD_NONE,NULL); |
| 1501 | if (o == NULL) { |
| 1502 | rdbReportCorruptRDB( |
| 1503 | "Error reading string from module %s value", modulename); |
| 1504 | } |
| 1505 | decrRefCount(o); |
| 1506 | } else if (opcode == RDB_MODULE_OPCODE_FLOAT) { |
| 1507 | float val; |
| 1508 | if (rdbLoadBinaryFloatValue(rdb,&val) == -1) { |
| 1509 | rdbReportCorruptRDB( |
| 1510 | "Error reading float from module %s value", modulename); |
| 1511 | } |
| 1512 | } else if (opcode == RDB_MODULE_OPCODE_DOUBLE) { |
| 1513 | double val; |
| 1514 | if (rdbLoadBinaryDoubleValue(rdb,&val) == -1) { |
| 1515 | rdbReportCorruptRDB( |
| 1516 | "Error reading double from module %s value", modulename); |
| 1517 | } |
| 1518 | } |
| 1519 | } |
| 1520 | return createStringObject("module-dummy-value",18); |
| 1521 | } |
| 1522 | |
| 1523 | /* Load a Redis object of the specified type from the specified file. |
| 1524 | * On success a newly allocated object is returned, otherwise NULL. |
no test coverage detected