Fix zstd decompression, files with large window settings did not work

This commit is contained in:
Tino Reichardt
2020-06-02 09:19:47 +02:00
parent 2890284f67
commit 9378903648

View File

@@ -87,6 +87,10 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream * inStream,
_dstBuf = MyAlloc(_dstBufSize); _dstBuf = MyAlloc(_dstBufSize);
if (!_dstBuf) if (!_dstBuf)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
result = ZSTD_DCtx_setParameter(_ctx, ZSTD_d_windowLogMax, ZSTD_WINDOWLOG_MAX);
if (ZSTD_isError(result))
return E_OUTOFMEMORY;
} else { } else {
ZSTD_resetDStream(_ctx); ZSTD_resetDStream(_ctx);
} }
@@ -115,11 +119,11 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream * inStream,
/* @Igor: would be nice, if we have an API to store the errmsg */ /* @Igor: would be nice, if we have an API to store the errmsg */
case ZSTD_error_memory_allocation: case ZSTD_error_memory_allocation:
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
case ZSTD_error_version_unsupported:
case ZSTD_error_frameParameter_unsupported: case ZSTD_error_frameParameter_unsupported:
case ZSTD_error_parameter_unsupported:
case ZSTD_error_version_unsupported:
return E_NOTIMPL; return E_NOTIMPL;
case ZSTD_error_frameParameter_windowTooLarge: case ZSTD_error_frameParameter_windowTooLarge:
case ZSTD_error_parameter_unsupported:
case ZSTD_error_parameter_outOfBound: case ZSTD_error_parameter_outOfBound:
return E_INVALIDARG; return E_INVALIDARG;
default: default: