From c792f5f1862e21000d4eb93b902dfba0d3f69fc8 Mon Sep 17 00:00:00 2001 From: Milan Sreckovic Date: Thu, 11 Dec 2014 12:05:51 -0500 Subject: [PATCH] Bug 1095510 - See if ClearRect has weird data. r=jmuizelaar --HG-- extra : rebase_source : bc587fc96d30cac3ef829f8ceabc72aae6831a98 --- gfx/2d/DrawTargetCairo.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gfx/2d/DrawTargetCairo.cpp b/gfx/2d/DrawTargetCairo.cpp index 61dc9da1616d..b0f4de85b0f7 100644 --- a/gfx/2d/DrawTargetCairo.cpp +++ b/gfx/2d/DrawTargetCairo.cpp @@ -1046,6 +1046,12 @@ DrawTargetCairo::ClearRect(const Rect& aRect) { AutoPrepareForDrawing prep(this, mContext); + if (!mContext || aRect.Width() <= 0 || aRect.Height() <= 0 || + !IsFinite(aRect.X()) || !IsFinite(aRect.Width()) || + !IsFinite(aRect.Y()) || !IsFinite(aRect.Height())) { + gfxCriticalError() << "ClearRect with invalid argument " << gfx::hexa(mContext) << " with " << aRect.Width() << "x" << aRect.Height() << " [" << aRect.X() << ", " << aRect.Y() << "]"; + } + cairo_set_antialias(mContext, CAIRO_ANTIALIAS_NONE); cairo_new_path(mContext); cairo_set_operator(mContext, CAIRO_OPERATOR_CLEAR);