diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-09-22 13:42:02 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-09-23 08:46:10 +0200 |
commit | 797315f220f82682748efaf80a29844a93f04f48 (patch) | |
tree | f11129728fd9bd046a9d1a3ce120797180809495 /vcl/skia/win | |
parent | 19365e6e2b3311bacb2ae2abb70be5cfaf843776 (diff) |
detect and fail immediately on failed Skia allocations (tdf#135952)
The problem with tdf#135952 is that the PNG export dialog can lead
to requesting an absurdly large image, which leads to allocation
failures. Some VCL backends such as headless try to cope with this
and bail out, but they often crash anyway, since at higher levels
of LO code nothing checks for these corner cases anyway. And even
if nothing would crash, this can lead to silently losing data.
So I've decided to directly detect such cases and fail hard and early.
Change-Id: I5277a65c794116206de8280faf22ff897daa2f56
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103171
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/skia/win')
-rw-r--r-- | vcl/skia/win/gdiimpl.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx index 5c5582b8ffe6..ce67db42914b 100644 --- a/vcl/skia/win/gdiimpl.cxx +++ b/vcl/skia/win/gdiimpl.cxx @@ -313,7 +313,7 @@ sk_sp<SkImage> SkiaCompatibleDC::getAsImage() const SkRect::MakeXYWH(0, 0, maRects.mnSrcWidth, maRects.mnSrcHeight), SkRect::MakeXYWH(0, 0, maRects.mnSrcWidth, maRects.mnSrcHeight), &paint); canvas->restore(); - return surface->makeImageSnapshot(); + return SkiaHelper::makeCheckedImageSnapshot(surface); } sk_sp<SkImage> SkiaCompatibleDC::getAsImageDiff(const SkiaCompatibleDC& white) const @@ -362,7 +362,7 @@ sk_sp<SkImage> SkiaCompatibleDC::getAsImageDiff(const SkiaCompatibleDC& white) c canvas->concat(matrix); canvas->drawBitmap(tmpBitmap, 0, 0, &paint); canvas->restore(); - return surface->makeImageSnapshot(); + return SkiaHelper::makeCheckedImageSnapshot(surface); } SkiaControlsCache::SkiaControlsCache() |