Merge pull request #940 from lz4/fix935

fix #935
This commit is contained in:
Yann Collet 2020-11-07 16:12:41 -08:00 committed by GitHub
commit 79a7c94017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -424,7 +424,9 @@ static const int dec64table[8] = {0, 0, 0, -1, -4, 1, 2, 3};
LZ4_FORCE_INLINE void LZ4_FORCE_INLINE void
LZ4_memcpy_using_offset_base(BYTE* dstPtr, const BYTE* srcPtr, BYTE* dstEnd, const size_t offset) LZ4_memcpy_using_offset_base(BYTE* dstPtr, const BYTE* srcPtr, BYTE* dstEnd, const size_t offset)
{ {
assert(srcPtr + offset == dstPtr);
if (offset < 8) { if (offset < 8) {
LZ4_write32(dstPtr, 0); /* silence an msan warning when offset==0 */
dstPtr[0] = srcPtr[0]; dstPtr[0] = srcPtr[0];
dstPtr[1] = srcPtr[1]; dstPtr[1] = srcPtr[1];
dstPtr[2] = srcPtr[2]; dstPtr[2] = srcPtr[2];
@ -464,7 +466,6 @@ LZ4_memcpy_using_offset(BYTE* dstPtr, const BYTE* srcPtr, BYTE* dstEnd, const si
BYTE v[8]; BYTE v[8];
assert(dstEnd >= dstPtr + MINMATCH); assert(dstEnd >= dstPtr + MINMATCH);
LZ4_write32(dstPtr, 0); /* silence an msan warning when offset==0 */
switch(offset) { switch(offset) {
case 1: case 1:
@ -473,7 +474,7 @@ LZ4_memcpy_using_offset(BYTE* dstPtr, const BYTE* srcPtr, BYTE* dstEnd, const si
case 2: case 2:
LZ4_memcpy(v, srcPtr, 2); LZ4_memcpy(v, srcPtr, 2);
LZ4_memcpy(&v[2], srcPtr, 2); LZ4_memcpy(&v[2], srcPtr, 2);
LZ4_memcpy(&v[4], &v[0], 4); LZ4_memcpy(&v[4], v, 4);
break; break;
case 4: case 4:
LZ4_memcpy(v, srcPtr, 4); LZ4_memcpy(v, srcPtr, 4);

View File

@ -789,7 +789,7 @@ static int LZ4HC_compress_optimal( LZ4HC_CCtx_internal* ctx,
int const nbSearches, size_t sufficient_len, int const nbSearches, size_t sufficient_len,
const limitedOutput_directive limit, int const fullUpdate, const limitedOutput_directive limit, int const fullUpdate,
const dictCtx_directive dict, const dictCtx_directive dict,
HCfavor_e favorDecSpeed); const HCfavor_e favorDecSpeed);
LZ4_FORCE_INLINE int LZ4HC_compress_generic_internal ( LZ4_FORCE_INLINE int LZ4HC_compress_generic_internal (