fixed minor coverity warning
This commit is contained in:
parent
158e7703bb
commit
3c174f4da9
@ -972,7 +972,7 @@ size_t ZDICT_trainFromBuffer_unsafe(
|
|||||||
for (u=1; u<dictList->pos; u++) {
|
for (u=1; u<dictList->pos; u++) {
|
||||||
U32 l = dictList[u].length;
|
U32 l = dictList[u].length;
|
||||||
ptr -= l;
|
ptr -= l;
|
||||||
if (ptr<(BYTE*)dictBuffer) return ERROR(GENERIC); /* should not happen */
|
if (ptr<(BYTE*)dictBuffer) { free(dictList); return ERROR(GENERIC); } /* should not happen */
|
||||||
memcpy(ptr, (const char*)samplesBuffer+dictList[u].pos, l);
|
memcpy(ptr, (const char*)samplesBuffer+dictList[u].pos, l);
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
@ -3864,11 +3864,9 @@ static size_t ZBUFF_decompressContinue(ZBUFF_DCtx* zbc, void* dst, size_t* maxDs
|
|||||||
|
|
||||||
case ZBUFFds_readHeader :
|
case ZBUFFds_readHeader :
|
||||||
/* read header from src */
|
/* read header from src */
|
||||||
{
|
{ size_t const headerSize = ZSTD_getFrameParams(&(zbc->params), src, *srcSizePtr);
|
||||||
size_t headerSize = ZSTD_getFrameParams(&(zbc->params), src, *srcSizePtr);
|
|
||||||
if (ZSTD_isError(headerSize)) return headerSize;
|
if (ZSTD_isError(headerSize)) return headerSize;
|
||||||
if (headerSize)
|
if (headerSize) {
|
||||||
{
|
|
||||||
/* not enough input to decode header : tell how many bytes would be necessary */
|
/* not enough input to decode header : tell how many bytes would be necessary */
|
||||||
memcpy(zbc->headerBuffer+zbc->hPos, src, *srcSizePtr);
|
memcpy(zbc->headerBuffer+zbc->hPos, src, *srcSizePtr);
|
||||||
zbc->hPos += *srcSizePtr;
|
zbc->hPos += *srcSizePtr;
|
||||||
@ -3882,8 +3880,7 @@ static size_t ZBUFF_decompressContinue(ZBUFF_DCtx* zbc, void* dst, size_t* maxDs
|
|||||||
|
|
||||||
case ZBUFFds_loadHeader:
|
case ZBUFFds_loadHeader:
|
||||||
/* complete header from src */
|
/* complete header from src */
|
||||||
{
|
{ size_t headerSize = ZBUFF_limitCopy(
|
||||||
size_t headerSize = ZBUFF_limitCopy(
|
|
||||||
zbc->headerBuffer + zbc->hPos, ZSTD_frameHeaderSize_max - zbc->hPos,
|
zbc->headerBuffer + zbc->hPos, ZSTD_frameHeaderSize_max - zbc->hPos,
|
||||||
src, *srcSizePtr);
|
src, *srcSizePtr);
|
||||||
zbc->hPos += headerSize;
|
zbc->hPos += headerSize;
|
||||||
@ -3895,12 +3892,12 @@ static size_t ZBUFF_decompressContinue(ZBUFF_DCtx* zbc, void* dst, size_t* maxDs
|
|||||||
*maxDstSizePtr = 0;
|
*maxDstSizePtr = 0;
|
||||||
return headerSize - zbc->hPos;
|
return headerSize - zbc->hPos;
|
||||||
} }
|
} }
|
||||||
|
/* intentional fallthrough */
|
||||||
|
|
||||||
case ZBUFFds_decodeHeader:
|
case ZBUFFds_decodeHeader:
|
||||||
/* apply header to create / resize buffers */
|
/* apply header to create / resize buffers */
|
||||||
{
|
{ size_t const neededOutSize = (size_t)1 << zbc->params.windowLog;
|
||||||
size_t neededOutSize = (size_t)1 << zbc->params.windowLog;
|
size_t const neededInSize = BLOCKSIZE; /* a block is never > BLOCKSIZE */
|
||||||
size_t neededInSize = BLOCKSIZE; /* a block is never > BLOCKSIZE */
|
|
||||||
if (zbc->inBuffSize < neededInSize) {
|
if (zbc->inBuffSize < neededInSize) {
|
||||||
free(zbc->inBuff);
|
free(zbc->inBuff);
|
||||||
zbc->inBuffSize = neededInSize;
|
zbc->inBuffSize = neededInSize;
|
||||||
|
Loading…
Reference in New Issue
Block a user