diff options
author | Yann Collet <cyan@fb.com> | 2018-04-27 19:46:49 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2018-04-27 19:46:49 (GMT) |
commit | 19b1267d44a6bd3fbb1b682d515a3ab5dc70ec50 (patch) | |
tree | 3526f87ecfba3663d2df43cbc2787d32c0a76e53 /lib | |
parent | 72e99c8939d7f005487403ab54fa65ac31ee4317 (diff) | |
download | lz4-19b1267d44a6bd3fbb1b682d515a3ab5dc70ec50.zip lz4-19b1267d44a6bd3fbb1b682d515a3ab5dc70ec50.tar.gz lz4-19b1267d44a6bd3fbb1b682d515a3ab5dc70ec50.tar.bz2 |
fix lz4hc -BD non-determinism
related to chain table update
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lz4hc.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c index 0778552..184ca8c 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -699,8 +699,6 @@ LZ4_FORCE_INLINE int LZ4HC_compress_generic_internal ( ctx->end += *srcSizePtr; if (cLevel < 1) cLevel = LZ4HC_CLEVEL_DEFAULT; /* note : convention is different from lz4frame, maybe something to review */ cLevel = MIN(LZ4HC_CLEVEL_MAX, cLevel); - assert(cLevel >= 0); - assert(cLevel <= LZ4HC_CLEVEL_MAX); { cParams_t const cParam = clTable[cLevel]; if (cParam.strat == lz4hc) return LZ4HC_compress_hashChain(ctx, @@ -892,7 +890,8 @@ void LZ4_attach_HC_dictionary(LZ4_streamHC_t *working_stream, const LZ4_streamHC static void LZ4HC_setExternalDict(LZ4HC_CCtx_internal* ctxPtr, const BYTE* newBlock) { DEBUGLOG(4, "LZ4HC_setExternalDict(%p, %p)", ctxPtr, newBlock); - if (ctxPtr->end >= ctxPtr->base + 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); /* Referencing remaining dictionary content */ + if (ctxPtr->end >= ctxPtr->base + ctxPtr->dictLimit + 4) + LZ4HC_Insert (ctxPtr, ctxPtr->end-3); /* Referencing remaining dictionary content */ /* Only one memory segment for extDict, so any previous extDict is lost at this stage */ ctxPtr->lowLimit = ctxPtr->dictLimit; |