In branch 3.0 ziplist.c 153 lines
“ if (ZIPLIST_LENGTH(zl) < UINT16_MAX)”
should it be " if (intrev16ifbe(ZIPLIST_LENGTH(zl)) < UINT16_MAX)"
because the ZIPLIST_LENGTH(zl) maybe in big-endian and UINT16_MAX is in little-endian
Comment From: mattsta
Yeah, looks like an oversight. The other usages of ZIPLIST_LENGTH() are wrapped in intrev16ifbe():
ziplist.c:154: ZIPLIST_LENGTH(zl) = intrev16ifbe(intrev16ifbe(ZIPLIST_LENGTH(zl))+incr); \
ziplist.c:881: if (intrev16ifbe(ZIPLIST_LENGTH(zl)) < UINT16_MAX) {
ziplist.c:882: len = intrev16ifbe(ZIPLIST_LENGTH(zl));
ziplist.c:891: if (len < UINT16_MAX) ZIPLIST_LENGTH(zl) = intrev16ifbe(len);
ziplist.c:911: intrev16ifbe(ZIPLIST_LENGTH(zl)),
Comment From: robscary
:+1: Should be fixed, possible fix is in https://github.com/antirez/redis/pull/2080