cid#1529287 Explicit null dereferenced

after

commit c55d5586304f23f9d8acbaffefba68a3a11c6175
Date:   Sat Apr 1 16:10:33 2023 +0100

    BinaryDataContainer: hand out shared_ptr's to SvStreams.

and

commit 0f2581204a70038ed7ca78089a9bd96d158e02c0
Date:   Mon Apr 3 09:34:54 2023 +0100

    BinaryDataContainer swap out implementation.

it is possible that a eLinkType of GfxLinkType::NativeGif and a
nStreamLength of 0 could lead to BinaryDataContainer::getAsStream
being called on a default ctored BinaryDataContainer which would
mean an mpImpl of null and a null dereference here

Change-Id: Id964e3ce97e5527c5357576131fe03440f1ea00c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151453
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2023-05-06 19:28:58 +01:00
parent 7ef7bf9304
commit 31a95393e6

View File

@ -912,7 +912,7 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
{
bool bAnimated = false;
Size aLogicSize;
if (eLinkType == GfxLinkType::NativeGif)
if (eLinkType == GfxLinkType::NativeGif && !aGraphicContent.isEmpty())
{
std::shared_ptr<SvStream> pMemoryStream = aGraphicContent.getAsStream();
bAnimated = IsGIFAnimated(*pMemoryStream, aLogicSize);