fixed wrong assertion

base can actually overflow
This commit is contained in:
Yann Collet 2018-05-10 19:48:09 -07:00
parent 0d7626672d
commit 99ddca43a6

View File

@ -2003,7 +2003,6 @@ static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc,
{ const BYTE* const base = ms->window.base;
const BYTE* const istart = (const BYTE*)src;
const U32 current = (U32)(istart-base);
assert(istart >= base);
if (sizeof(ptrdiff_t)==8) assert(istart - base < (ptrdiff_t)(U32)(-1)); /* ensure no overflow */
if (current > ms->nextToUpdate + 384)
ms->nextToUpdate = current - MIN(192, (U32)(current - ms->nextToUpdate - 384));