summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-04-23 15:48:41 +0200
committerXisco Faulí <xiscofauli@libreoffice.org>2019-04-24 12:09:04 +0200
commit2dd410421331eb2a593a9e9ca2f73e2aa1c2a694 (patch)
tree07204a7c9eceb3f80e938768e79454ebb028bdb4 /filter
parent771be5a31c6cb40e1be30f71c2f02708292f2518 (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> (cherry picked from commit af84fc9d906626255aaf136eefc5e55236e0e8a6) Reviewed-on: https://gerrit.libreoffice.org/71221 Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/msdffimp.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 30dc80c92f8b..c9087180ecdf 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6553,7 +6553,11 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& rBLIPStream, Graphic& rData, tool
else
{ // and unleash our filter
GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
- Graphic aGraphic = rGF.ImportUnloadedGraphic(*pGrStream);
+ // ImportUnloadedGraphic() may simply read the entire rest of the stream,
+ // which may be very large if the whole document is large. Limit the read
+ // size to the size of this record.
+ sal_uInt64 maxSize = pGrStream == &rBLIPStream ? nLength : 0;
+ Graphic aGraphic = rGF.ImportUnloadedGraphic(*pGrStream, maxSize);
if (aGraphic)
{
rData = aGraphic;