summaryrefslogtreecommitdiff
path: root/src/crcspeed.c
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2021-01-05 09:15:10 +0200
committerGitHub <noreply@github.com>2021-01-05 09:15:10 +0200
commit324070c8f6f63240629893c2ce9bcbeecf6e77fb (patch)
tree5aa851bb0733dc56700affc6b612e96c791b6d39 /src/crcspeed.c
parent2017407b4d1d19a91af1e7c0b199f2c1775dbaf9 (diff)
downloadredis-324070c8f6f63240629893c2ce9bcbeecf6e77fb.tar.gz
Fix rdb checksum / crc64 on bigendian (#8270)
Turns out the RDB checksum in Redis 6.0 on bigendian is broken. It always returned 0, so the RDB files are generated as if checksum is disabled, and will be loaded ok on littleendian, and on bigendian. But it'll not be able to load RDB files generated on littleendian or older versions. Similarly DUMP and RESTORE will work on the same version (0==0), but will be unable to exchange dump payloads with littleendian or old versions.
Diffstat (limited to 'src/crcspeed.c')
-rw-r--r--src/crcspeed.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/crcspeed.c b/src/crcspeed.c
index d4955bfc9..67cb8fd9f 100644
--- a/src/crcspeed.c
+++ b/src/crcspeed.c
@@ -35,7 +35,8 @@ void crcspeed64little_init(crcfn64 crcfn, uint64_t table[8][256]) {
/* generate CRCs for all single byte sequences */
for (int n = 0; n < 256; n++) {
- table[0][n] = crcfn(0, &n, 1);
+ unsigned char v = n;
+ table[0][n] = crcfn(0, &v, 1);
}
/* generate nested CRC table for future slice-by-8 lookup */