[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Aug 8 09:03:51 UTC 2016


 vcl/source/filter/GraphicNativeMetadata.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit 8452bef1c2cc7585582875fd3216ed4003b817cc
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 8 04:52:28 2016 +0200

    don't try to memcpy from and to a nullptr
    
    See e.g.
    http://crashreport.libreoffice.org/stats/crash_details/2218a489-b64c-4193-a7d4-cd01c6a607cb
    
    Change-Id: I6c123d3e9e5c6dbcb7756a686503904cbfd944a4
    Reviewed-on: https://gerrit.libreoffice.org/27948
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    (cherry picked from commit 855df248c8a380e253a35feefec21ebc1dee1aca)
    Reviewed-on: https://gerrit.libreoffice.org/27978
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/filter/GraphicNativeMetadata.cxx b/vcl/source/filter/GraphicNativeMetadata.cxx
index 532e2d4..8904577 100644
--- a/vcl/source/filter/GraphicNativeMetadata.cxx
+++ b/vcl/source/filter/GraphicNativeMetadata.cxx
@@ -37,7 +37,11 @@ bool GraphicNativeMetadata::read(Graphic& rGraphic)
     GfxLink aLink = rGraphic.GetLink();
     if ( aLink.GetType() != GFX_LINK_TYPE_NATIVE_JPG )
         return false;
+
     sal_uInt32 aDataSize = aLink.GetDataSize();
+    if (!aDataSize)
+        return false;
+
     std::unique_ptr<sal_uInt8[]> aBuffer(new sal_uInt8[aDataSize]);
 
     memcpy(aBuffer.get(), aLink.GetData(), aDataSize);


More information about the Libreoffice-commits mailing list