summaryrefslogtreecommitdiff
path: root/vcl/headless
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-11-04 13:16:34 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-11-04 17:22:59 +0100
commite77beab92dfe1136a59c99af6571de6eae9f7e12 (patch)
treee71bb8fab401668dd395cd1040909dac7661d397 /vcl/headless
parentc44f64621fe11d6a46c79b9793c7c67c60bb66e8 (diff)
ofz#53034 Null-dereference
Change-Id: I3be4f2b976b64a2f592eeef9802e6cf8dd15341b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142278 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/headless')
-rw-r--r--vcl/headless/CairoCommon.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 8f11fdbd9b6c..a25c508f39ce 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -597,12 +597,20 @@ void CairoCommon::clipRegion(cairo_t* cr, const vcl::Region& rClipRegion)
}
if (!aRectangles.empty())
{
+ bool bEmpty = true;
for (auto const& rectangle : aRectangles)
{
+ if (rectangle.GetWidth() <= 0 || rectangle.GetHeight() <= 0)
+ {
+ SAL_WARN("vcl.gdi", "bad clip rect of: " << rectangle);
+ continue;
+ }
cairo_rectangle(cr, rectangle.Left(), rectangle.Top(), rectangle.GetWidth(),
rectangle.GetHeight());
+ bEmpty = false;
}
- cairo_clip(cr);
+ if (!bEmpty)
+ cairo_clip(cr);
}
}