tools/source/generic/poly.cxx |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 80d99a387fa0d5b8764dab720c20e2d3754e610b
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Mar 5 10:29:15 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Mar 5 14:51:31 2022 +0100

    ofz: Use-of-uninitialized-value
    
    Change-Id: If75e11dc26aae51d658dddd464135dd8a4f965ce
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131054
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 13d2df0e47ef..6e5b2d778fa7 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1663,7 +1663,12 @@ void Polygon::ImplRead( SvStream& rIStream )
     if ( bHasPolyFlags )
     {
         mpImplPolygon->mxFlagAry.reset(new PolyFlags[mpImplPolygon->mnPoints]);
-        rIStream.ReadBytes(mpImplPolygon->mxFlagAry.get(), 
mpImplPolygon->mnPoints);
+        auto nRead = rIStream.ReadBytes(mpImplPolygon->mxFlagAry.get(), 
mpImplPolygon->mnPoints);
+        if (nRead != mpImplPolygon->mnPoints)
+        {
+            SAL_WARN("tools", "Short read");
+            memset(mpImplPolygon->mxFlagAry.get() + nRead, 0, 
mpImplPolygon->mnPoints - nRead);
+        }
     }
 }
 

Reply via email to