vcl/source/filter/GraphicFormatDetector.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
New commits: commit fa387c3a99ebd033586b6f0a45276016dda56b45 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Sep 3 10:38:14 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Sep 3 20:58:56 2021 +0200 ofz: MemorySanitizer: use-of-uninitialized-value Change-Id: I6bafceac5ebd1852aaf296abe89b49b74ad884d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121598 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/source/filter/GraphicFormatDetector.cxx b/vcl/source/filter/GraphicFormatDetector.cxx index dafe7f5222b4..6c8df32a456e 100644 --- a/vcl/source/filter/GraphicFormatDetector.cxx +++ b/vcl/source/filter/GraphicFormatDetector.cxx @@ -700,7 +700,9 @@ bool GraphicFormatDetector::checkSVG() ZCodec aCodec; mrStream.Seek(mnStreamPosition); aCodec.BeginCompression(ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/ true); - nDecompressedSize = aCodec.Read(mrStream, sExtendedOrDecompressedFirstBytes, 2048); + auto nDecompressedOut = aCodec.Read(mrStream, sExtendedOrDecompressedFirstBytes, 2048); + // ZCodec::Decompress returns -1 on failure + nDecompressedSize = nDecompressedOut < 0 ? 0 : nDecompressedOut; nCheckSize = std::min<sal_uInt64>(nDecompressedSize, 256); aCodec.EndCompression(); pCheckArray = sExtendedOrDecompressedFirstBytes;