diff options
author | Yann Collet <yann.collet.73@gmail.com> | 2014-08-01 18:10:21 (GMT) |
---|---|---|
committer | Yann Collet <yann.collet.73@gmail.com> | 2014-08-01 18:10:21 (GMT) |
commit | 7ac18ad9dc5a5555f9129659c007fe9141e422b0 (patch) | |
tree | 9e6b4627c32f33ac6a5212afbcce9e3a66270d98 /lz4hc.c | |
parent | 17fdc54813582d3235401f287999cc17c466ab5f (diff) | |
download | lz4-7ac18ad9dc5a5555f9129659c007fe9141e422b0.zip lz4-7ac18ad9dc5a5555f9129659c007fe9141e422b0.tar.gz lz4-7ac18ad9dc5a5555f9129659c007fe9141e422b0.tar.bz2 |
fix : HC streaming mode
Diffstat (limited to 'lz4hc.c')
-rw-r--r-- | lz4hc.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -400,7 +400,10 @@ FORCE_INLINE void LZ4HC_Insert (LZ4HC_Data_Structure* hc4, const BYTE* ip) char* LZ4_slideInputBufferHC(void* LZ4HC_Data) { LZ4HC_Data_Structure* hc4 = (LZ4HC_Data_Structure*)LZ4HC_Data; - U32 distance = (U32)(hc4->end - hc4->inputBuffer) - 64 KB; + size_t distance = (hc4->end - 64 KB) - hc4->inputBuffer; + + if (hc4->end <= hc4->inputBuffer + 64 KB) return (char*)(hc4->end); /* no update : less than 64KB within buffer */ + distance = (distance >> 16) << 16; /* Must be a multiple of 64 KB */ LZ4HC_Insert(hc4, hc4->end - MINMATCH); memcpy((void*)(hc4->end - 64 KB - distance), (const void*)(hc4->end - 64 KB), 64 KB); |