From: shakeelrao Date: Wed, 13 Mar 2019 08:23:07 +0000 (-0700) Subject: Fix incorrectly assigned value in ZSTD_errorFrameSizeInfo X-Git-Tag: v1.4.0^2~27^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79827a179f2b659928487aeb9cf802d675aa7840;p=thirdparty%2Fzstd.git Fix incorrectly assigned value in ZSTD_errorFrameSizeInfo As documented in `zstd.h`, ZSTD_decompressBound returns `ZSTD_CONTENTSIZE_ERROR` if an error occurs (not `ZSTD_CONTENTSIZE_UNKNOWN`). This is consistent with the error checking made in ZSTD_decompressBound, particularly line 545. --- diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 268ba386a..9974dbe3b 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -437,7 +437,7 @@ static size_t ZSTD_decodeFrameHeader(ZSTD_DCtx* dctx, const void* src, size_t he * Contains the compressed frame size and an upper-bound for the decompressed frame size. * Note: before using `compressedSize` you must check for errors using ZSTD_isError(). * similarly, before using `decompressedBound`, you must check for errors using: - * `decompressedBound` != ZSTD_CONTENTSIZE_UNKNOWN + * `decompressedBound` != ZSTD_CONTENTSIZE_ERROR */ typedef struct { size_t compressedSize; @@ -448,7 +448,7 @@ static ZSTD_frameSizeInfo ZSTD_errorFrameSizeInfo(size_t ret) { ZSTD_frameSizeInfo frameSizeInfo; frameSizeInfo.compressedSize = ret; - frameSizeInfo.decompressedBound = ZSTD_CONTENTSIZE_UNKNOWN; + frameSizeInfo.decompressedBound = ZSTD_CONTENTSIZE_ERROR; return frameSizeInfo; }