[Libreoffice-commits] core.git: vcl/source

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Aug 8 04:04:06 UTC 2016


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

New commits:
commit 855df248c8a380e253a35feefec21ebc1dee1aca
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>

diff --git a/vcl/source/filter/GraphicNativeMetadata.cxx b/vcl/source/filter/GraphicNativeMetadata.cxx
index 2f9880c..aea930d 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() != GfxLinkType::NativeJpg )
         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