From: Stella Lau Date: Thu, 29 Jun 2017 22:40:49 +0000 (-0700) Subject: Fix bitshift error X-Git-Tag: v1.3.0~1^2~7^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=104c4d57c1fa7ca6872ad95925a9448bc3d1f1db;p=thirdparty%2Fzstd.git Fix bitshift error --- diff --git a/lib/decompress/huf_decompress.c b/lib/decompress/huf_decompress.c index cbf78e807..68938aebd 100644 --- a/lib/decompress/huf_decompress.c +++ b/lib/decompress/huf_decompress.c @@ -110,8 +110,8 @@ size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, const void* src, size_t srcSize huffWeight = (BYTE *)((U32 *)workSpace + spaceUsed32); spaceUsed32 += ALIGN(HUF_SYMBOLVALUE_MAX + 1, sizeof(U32)) >> 2; - if ((spaceUsed32 >> 2) > wkspSize) - return ERROR(tableLog_tooLarge); + if ((spaceUsed32 << 2) > wkspSize) + return ERROR(tableLog_tooLarge); workSpace = (U32 *)workSpace + spaceUsed32; wkspSize -= (spaceUsed32 << 2); @@ -524,7 +524,7 @@ size_t HUF_readDTableX4_wksp(HUF_DTable* DTable, const void* src, weightList = (BYTE *)((U32 *)workSpace + spaceUsed32); spaceUsed32 += ALIGN(HUF_SYMBOLVALUE_MAX + 1, sizeof(U32)) >> 2; - if ((spaceUsed32 >> 2) > wkspSize) + if ((spaceUsed32 << 2) > wkspSize) return ERROR(tableLog_tooLarge); workSpace = (U32 *)workSpace + spaceUsed32; wkspSize -= (spaceUsed32 << 2);