sanitize dump payload for HFE#13278
Conversation
| if ((uint64_t)expire_at < data->last_expireat) return 0; | ||
| data->last_expireat = expire_at; | ||
| } | ||
|
|
There was a problem hiding this comment.
Just an idea: maybe lpValidateIntegrity can get an array of entry validation functions instead of a single pointer, where each such validation callback will have its own opaque data and the offset at which it should be called, from 0 to tuple_len (tuple_len is a special case for all entries, or -1 can be used for that instead).
So the validation function will be called only when reaching an entry in the listpack for which idx % tuple_len == offset, for example, if the tuple_len is 3 and the offset is 2, it will only be called for the TTL entries.
IMHO this will be a more generic approach, in which the same CB is not shared for validating different object types.
You can pass an array of such structs instead of the CB and data to lpValidateIntegrity:
typedef struct { listpackValidateEntryCB entry_cb; void *cb_userdata; int offset; } listpackEntryValidator;
And then we can have one validator for filed uniqueness and one validator for TTL validity.
There was a problem hiding this comment.
this is a good idea, however it also bring a lot of changes, and all lpValidateIntegrity* methods will be changed.
i still want to leave it as now, and optimize it in the future if it doesn't meet the needs.
i started by simply copying a new lpexValidateIntegrity, then i chose to put the TTL fields validation in _lpEntryValidation because i thought it would be the least chage.
Co-authored-by: Ozan Tezcan <[email protected]>
Co-authored-by: Ozan Tezcan <[email protected]>
Add the following validations: 1. Get TTL using the lpGetIntegerValue() method instead of lpGetValue(), Ref redis#13209 (comment) 2. The TTL of listpackex is a number in the valid range (0~EB_EXPIRE_TIME_MAX) and ordered. 3. The TTL fields of listpackex are ordered. 4. The TTL of hashtable is within the valid range (0~EB_EXPIRE_TIME_MAX). Other: Fix the missing of handling OBJ_ENCODING_LISTPACK_EX in dismissHashObject(). --------- Co-authored-by: Ozan Tezcan <[email protected]>
Add the following validations:
Other:
Fix the missing of handling OBJ_ENCODING_LISTPACK_EX in dismissHashObject().