From: Nick Terrell Date: Thu, 24 Aug 2023 23:33:42 +0000 (-0700) Subject: Work around nullptr-with-nonzero-offset warning X-Git-Tag: v1.5.6^2~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c27fa399042f466080e79bb4fd8a4871bc0bcf28;p=thirdparty%2Fzstd.git Work around nullptr-with-nonzero-offset warning See comment. --- diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 94eb95151..ccfd84fa4 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -1548,6 +1548,12 @@ size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx) dctx->stage = ZSTDds_getFrameHeaderSize; dctx->processedCSize = 0; dctx->decodedSize = 0; + /* Set to non-null because ZSTD_prefetchMatch() may end up doing addition + * with this value for corrupted frames. However, it then just passes the + * pointer to PREFETCH_L1(), which doesn't require valid pointers. But, + * if it is NULL we get nullptr-with-nonzero-offset UBSAN warnings. + */ + dctx->previousDstEnd = ""; dctx->previousDstEnd = NULL; dctx->prefixStart = NULL; dctx->virtualStart = NULL;