From: Vincent Povirk Subject: gdiplus: Fix error when drawing from a rectangle outside bitmap bounds. Message-Id: Date: Tue, 28 Oct 2014 16:15:11 -0500 For bug 37394. From 32c641eff70c9f3d02feeb21baeb418786a144df Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Tue, 28 Oct 2014 16:09:57 -0500 Subject: [PATCH] gdiplus: Fix error when drawing from a rectangle outside bitmap bounds. --- dlls/gdiplus/graphics.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index d192bf2..b34b31c 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -827,6 +827,15 @@ static void get_bitmap_sample_size(InterpolationMode interpolation, WrapMode wra right = bitmap->width-1; if (bottom >= bitmap->height) bottom = bitmap->height-1; + if (bottom <= top || right <= left) + { + /* entirely outside image, just sample a pixel so we don't have to + * special-case this later */ + left = 0; + top = 0; + right = 1; + bottom = 1; + } } else { -- 2.1.0