diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-09-03 10:38:14 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-09-03 20:58:56 +0200 |
commit | fa387c3a99ebd033586b6f0a45276016dda56b45 (patch) | |
tree | 73dbb9f7ebc0833106dd860933ba2ec573e90fde | |
parent | e44c97e8a8a403b8bd1e0c3e5943ebe19dec56fe (diff) |
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 <caolanm@redhat.com>
-rw-r--r-- | vcl/source/filter/GraphicFormatDetector.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
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; |