diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-08-08 04:52:28 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-08-08 04:03:30 +0000 |
commit | 855df248c8a380e253a35feefec21ebc1dee1aca (patch) | |
tree | 46be09db696d242de4d6b2e856ea2e1cf17b5c15 /vcl | |
parent | 12408dad1b2af4055b91439e3cfbe46e0df52b41 (diff) |
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@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/GraphicNativeMetadata.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/vcl/source/filter/GraphicNativeMetadata.cxx b/vcl/source/filter/GraphicNativeMetadata.cxx index 2f9880c00282..aea930d7174f 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); |