mirror of
https://github.com/facebook/zstd.git
synced 2024-12-01 10:16:46 +08:00
fixed decoder error (rollbuffer mode)
This commit is contained in:
parent
ad50c59bb7
commit
bf7aa3c14e
@ -68,7 +68,7 @@ extern "C" {
|
||||
|
||||
#define ERROR_LIST(ITEM) \
|
||||
ITEM(PREFIX(No_Error)) ITEM(PREFIX(GENERIC)) \
|
||||
ITEM(PREFIX(prefix_unknown)) ITEM(PREFIX(frameParameter_unsupportedBy32bitsImplementation)) \
|
||||
ITEM(PREFIX(prefix_unknown)) ITEM(PREFIX(frameParameter_unsupported)) ITEM(PREFIX(frameParameter_unsupportedBy32bitsImplementation)) \
|
||||
ITEM(PREFIX(init_missing)) ITEM(PREFIX(memory_allocation)) \
|
||||
ITEM(PREFIX(dstSize_tooSmall)) ITEM(PREFIX(srcSize_wrong)) \
|
||||
ITEM(PREFIX(corruption_detected)) \
|
||||
|
@ -195,6 +195,7 @@ size_t ZSTD_getFrameParams(ZSTD_parameters* params, const void* src, size_t srcS
|
||||
if (magicNumber != ZSTD_MAGICNUMBER) return ERROR(prefix_unknown);
|
||||
memset(params, 0, sizeof(*params));
|
||||
params->windowLog = (((const BYTE*)src)[4] & 15) + ZSTD_WINDOWLOG_ABSOLUTEMIN;
|
||||
if ((((const BYTE*)src)[4] >> 4) != 0) return ERROR(frameParameter_unsupported); /* reserved bits */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -785,8 +786,8 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* ctx, void* dst, size_t maxDstSize, con
|
||||
if (srcSize != ctx->expected) return ERROR(srcSize_wrong);
|
||||
if (dst != ctx->previousDstEnd) /* not contiguous */
|
||||
{
|
||||
if (((char*)dst + maxDstSize > (char*)ctx->base) && (dst < ctx->previousDstEnd)) /* rolling buffer : new segment into dictionary */
|
||||
ctx->base = (char*)dst + maxDstSize; /* temporary affectation, for vBase calculation */
|
||||
if ((dst > ctx->base) && (dst < ctx->previousDstEnd)) /* rolling buffer : new segment into dictionary */
|
||||
ctx->base = (char*)dst; /* temporary affectation, for vBase calculation */
|
||||
ctx->dictEnd = ctx->previousDstEnd;
|
||||
ctx->vBase = (char*)dst - ((char*)(ctx->previousDstEnd) - (char*)(ctx->base));
|
||||
ctx->base = dst;
|
||||
|
Loading…
Reference in New Issue
Block a user