changed error code when pos<=size condition is not respected

Now pointing towards src_size or dst_size,
instead of error_GENERIC.
This commit is contained in:
Yann Collet
2017-09-27 10:35:56 -07:00
parent d56a350402
commit 9416195221
3 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -2407,12 +2407,12 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
if (input->pos > input->size) { /* forbidden */
DEBUGLOG(5, "in: pos: %u vs size: %u",
(U32)input->pos, (U32)input->size);
return ERROR(GENERIC);
return ERROR(srcSize_wrong);
}
if (output->pos > output->size) { /* forbidden */
DEBUGLOG(5, "out: pos: %u vs size: %u",
(U32)output->pos, (U32)output->size);
return ERROR(GENERIC);
return ERROR(dstSize_tooSmall);
}
DEBUGLOG(5, "input size : %u", (U32)(input->size - input->pos));