converted checks into user validation generating error codes

had to create a new error code for this condition,
none of the existing ones were fitting enough.
This commit is contained in:
Yann Collet
2022-01-26 10:43:50 -08:00
parent af3d9c506e
commit b99ece96b9
3 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -5678,8 +5678,8 @@ size_t ZSTD_compressStream2( ZSTD_CCtx* cctx,
&& (totalInputSize < ZSTD_BLOCKSIZE_MAX) ) { /* not even reached one block yet */
if (cctx->stableIn_notConsumed) { /* not the first time */
/* check stable source guarantees */
assert(input->src == cctx->expectedInBuffer.src);
assert(input->pos == cctx->expectedInBuffer.size);
RETURN_ERROR_IF(input->src != cctx->expectedInBuffer.src, stabilityCondition_notRespected, "stableInBuffer condition not respected: wrong src pointer");
RETURN_ERROR_IF(input->pos != cctx->expectedInBuffer.size, stabilityCondition_notRespected, "stableInBuffer condition not respected: externally modified pos");
}
/* pretend input was consumed, to give a sense forward progress */
input->pos = input->size;