diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-04-23 15:48:41 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-04-24 08:59:29 +0200 |
commit | af84fc9d906626255aaf136eefc5e55236e0e8a6 (patch) | |
tree | 4e22bda9bc712517f6c1500ee56d50628700100f /vcl | |
parent | 75e3e7f2890438aadab28964c207f5308b7ffd4f (diff) |
lazy image loading shouldn't read the entire .xls file (tdf#124828)
b11188835d3b87cd changed msfilter to use
GraphicFilter::ImportUnloadedGraphic() to lazy-load images
from the document. However, that function in some cases simply
reads the entire rest of the passed SvStream, which in this case
is the entire .xls file. And the document from tdf#124828 is ~50MiB
and contains ~4000 images => 100+ GiB memory required.
Change-Id: I74926383204ec642eabb28b62e2cf2e1ff8054a9
Reviewed-on: https://gerrit.libreoffice.org/71136
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 920c64160b55..10a4559a8db4 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1427,7 +1427,7 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra } } -Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream) +Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 sizeLimit) { Graphic aGraphic; sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW; @@ -1442,7 +1442,7 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream) ErrCode nStatus = ImpTestOrFindFormat("", rIStream, nFormat); rIStream.Seek(nStreamBegin); - const sal_uInt32 nStreamLength(rIStream.remainingSize()); + const sal_uInt32 nStreamLength( sizeLimit ? sizeLimit : rIStream.remainingSize()); OUString aFilterName = pConfig->GetImportFilterName(nFormat); OUString aExternalFilterName = pConfig->GetExternalFilterName(nFormat, false); |