[Libreoffice-commits] core.git: emfio/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 30 09:32:58 UTC 2021
emfio/source/reader/emfreader.cxx | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
New commits:
commit 4099f7102a78f552eb85fadda7851db3c73b2d0f
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Aug 29 14:32:31 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Aug 30 11:32:24 2021 +0200
ofz: MemorySanitizer: use-of-uninitialized-value
Change-Id: Ibeeef815afea9bee3cdf6b6de17de4f836b00351
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121223
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index f3c1fffdfd77..6e6893c8afb2 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1734,10 +1734,25 @@ namespace emfio
.WriteUInt16( 0 )
.WriteUInt16( 0 )
.WriteUInt32( cbBmiSrc + 14 );
+
mpInputStream->Seek( nStart + offBmiSrc );
- mpInputStream->ReadBytes(pBuf + 14, cbBmiSrc);
+ char* pWritePos = pBuf + 14;
+ auto nRead = mpInputStream->ReadBytes(pWritePos, cbBmiSrc);
+ if (nRead != cbBmiSrc)
+ {
+ // zero remainder if short read
+ memset(pWritePos + nRead, 0, cbBmiSrc - nRead);
+ }
+
mpInputStream->Seek( nStart + offBitsSrc );
- mpInputStream->ReadBytes(pBuf + 14 + cbBmiSrc, cbBitsSrc);
+ pWritePos = pBuf + 14 + cbBmiSrc;
+ nRead = mpInputStream->ReadBytes(pWritePos, cbBitsSrc);
+ if (nRead != cbBitsSrc)
+ {
+ // zero remainder if short read
+ memset(pWritePos + nRead, 0, cbBitsSrc - nRead);
+ }
+
aTmp.Seek( 0 );
ReadDIB(aBitmap, aTmp, true);
More information about the Libreoffice-commits
mailing list