summaryrefslogtreecommitdiff
path: root/src/ziplist.c
diff options
context:
space:
mode:
authorsundb <sundbcn@gmail.com>2021-08-09 22:13:46 +0800
committerGitHub <noreply@github.com>2021-08-09 17:13:46 +0300
commitcbda492909cd2fff25263913cd2e1f00bc48a541 (patch)
tree41259a16a00ac606cc81605d0f172f6975809a8b /src/ziplist.c
parent0b643e930d978862b3284ba742fba1a659832b8c (diff)
downloadredis-cbda492909cd2fff25263913cd2e1f00bc48a541.tar.gz
Sanitize dump payload: handle remaining empty key when RDB loading and restore command (#9349)
This commit mainly fixes empty keys due to RDB loading and restore command, which was omitted in #9297. 1) When loading quicklsit, if all the ziplists in the quicklist are empty, NULL will be returned. If only some of the ziplists are empty, then we will skip the empty ziplists silently. 2) When loading hash zipmap, if zipmap is empty, sanitization check will fail. 3) When loading hash ziplist, if ziplist is empty, NULL will be returned. 4) Add RDB loading test with sanitize.
Diffstat (limited to 'src/ziplist.c')
-rw-r--r--src/ziplist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ziplist.c b/src/ziplist.c
index 1b934a292..b55c85fcf 100644
--- a/src/ziplist.c
+++ b/src/ziplist.c
@@ -1527,7 +1527,7 @@ int ziplistValidateIntegrity(unsigned char *zl, size_t size, int deep,
return 0;
/* Make sure the <zltail> entry really do point to the start of the last entry. */
- if (prev != ZIPLIST_ENTRY_TAIL(zl))
+ if (prev != NULL && prev != ZIPLIST_ENTRY_TAIL(zl))
return 0;
/* Check that the count in the header is correct */