mirror of
https://github.com/facebook/zstd.git
synced 2025-08-01 09:47:01 +03:00
Fix ZSTD_f_zstd1_magicless for small data
* Fix `ZSTD_FRAMEHEADERSIZE_PREFIX` and `ZSTD_FRAMEHEADERSIZE_MIN` to take a `format` parameter, so it is impossible to get the wrong size. * Fix the places that called `ZSTD_FRAMEHEADERSIZE_PREFIX` without taking the format into account, which is now impossible by design. * Call `ZSTD_frameHeaderSize_internal()` with `dctx->format`. * The added tests catch both bugs in `ZSTD_decompressFrame()`. Fixes #1813.
This commit is contained in:
@ -2443,7 +2443,7 @@ FIO_analyzeFrames(fileInfo_t* info, FILE* const srcFile)
|
||||
for ( ; ; ) {
|
||||
BYTE headerBuffer[ZSTD_FRAMEHEADERSIZE_MAX];
|
||||
size_t const numBytesRead = fread(headerBuffer, 1, sizeof(headerBuffer), srcFile);
|
||||
if (numBytesRead < ZSTD_FRAMEHEADERSIZE_MIN) {
|
||||
if (numBytesRead < ZSTD_FRAMEHEADERSIZE_MIN(ZSTD_f_zstd1)) {
|
||||
if ( feof(srcFile)
|
||||
&& (numBytesRead == 0)
|
||||
&& (info->compressedSize > 0)
|
||||
|
Reference in New Issue
Block a user