From: Yann Collet Date: Tue, 17 Apr 2018 23:47:56 +0000 (-0700) Subject: fixed LZ4_compress_fast_extState_fastReset() in 32-bit mode X-Git-Tag: upstream/1.9.3~8^2~33^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ad4599c5ad18d2408a6ccc545c45a36b99f0c6f;p=platform%2Fupstream%2Flz4.git fixed LZ4_compress_fast_extState_fastReset() in 32-bit mode --- diff --git a/lib/lz4.c b/lib/lz4.c index e7553ed..33aa5c7 100644 --- a/lib/lz4.c +++ b/lib/lz4.c @@ -983,7 +983,7 @@ int LZ4_compress_fast_extState_fastReset(void* state, const char* src, char* dst return LZ4_compress_generic(ctx, src, dst, srcSize, 0, notLimited, tableType, noDict, noDictIssue, acceleration); } } else { - const tableType_t tableType = (sizeof(void*)==8) ? byU32 : byPtr; + const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)src > MAX_DISTANCE)) ? byPtr : byU32; LZ4_prepareTable(ctx, srcSize, tableType); return LZ4_compress_generic(ctx, src, dst, srcSize, 0, notLimited, tableType, noDict, noDictIssue, acceleration); } @@ -997,7 +997,7 @@ int LZ4_compress_fast_extState_fastReset(void* state, const char* src, char* dst return LZ4_compress_generic(ctx, src, dst, srcSize, dstCapacity, limitedOutput, tableType, noDict, noDictIssue, acceleration); } } else { - const tableType_t tableType = (sizeof(void*)==8) ? byU32 : byPtr; + const tableType_t tableType = ((sizeof(void*)==4) && ((uptrval)src > MAX_DISTANCE)) ? byPtr : byU32; LZ4_prepareTable(ctx, srcSize, tableType); return LZ4_compress_generic(ctx, src, dst, srcSize, dstCapacity, limitedOutput, tableType, noDict, noDictIssue, acceleration); }