[Libreoffice-commits] core.git: sw/qa vcl/headless

Stephan Bergmann sbergman at redhat.com
Thu Jan 21 07:30:44 PST 2016


 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |    2 +-
 vcl/headless/svpbmp.cxx                  |    8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit a73e606b8cd714520285b4e40890db9fd27d7ba5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jan 21 16:04:28 2016 +0100

    Quickfix for deterministic SvpSalBitmap checksums
    
    ...that include the junk parts of the mpDIB->mpBits array in the calculation.
    MALLOC_PERTURB_=153 in gb_CppunitTest_malloc_check
    (solenv/gbuild/platform/unxgcc.mk) causes those junk bytes to normally contain
    0x66 on Linux, but ASan makes them contain 0xBE instead.
    
    Change-Id: I74429c5e539e667cb936b3a486de31867eef3e50

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 635137e..5fd2bf8 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -773,7 +773,7 @@ DECLARE_OOXMLIMPORT_TEST(testN777345, "n777345.docx")
     Graphic aGraphic(xGraphic);
     // If this changes later, feel free to update it, but make sure it's not
     // the checksum of a white/transparent placeholder rectangle.
-    CPPUNIT_ASSERT_EQUAL(BitmapChecksum(SAL_CONST_UINT64(17166884950237449306)), aGraphic.GetChecksum());
+    CPPUNIT_ASSERT_EQUAL(BitmapChecksum(SAL_CONST_UINT64(12149824012634930130)), aGraphic.GetChecksum());
 #endif
 }
 
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index 2fe05d2..293b222 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -19,6 +19,10 @@
 
 #ifndef IOS
 
+#include <sal/config.h>
+
+#include <cstring>
+
 #include "headless/svpbmp.hxx"
 #include "headless/svpgdi.hxx"
 #include "headless/svpinst.hxx"
@@ -117,15 +121,17 @@ BitmapBuffer* ImplCreateDIB(
                 pDIB->maPalette.SetEntryCount( nColors );
             }
 
+            auto size = pDIB->mnScanlineSize * pDIB->mnHeight;
             try
             {
-                pDIB->mpBits = new sal_uInt8[ pDIB->mnScanlineSize * pDIB->mnHeight ];
+                pDIB->mpBits = new sal_uInt8[size];
             }
             catch (const std::bad_alloc&)
             {
                 delete pDIB;
                 pDIB = nullptr;
             }
+            std::memset(pDIB->mpBits, 0, size);
         }
     }
     else


More information about the Libreoffice-commits mailing list