From d19dcb689f47e12792b3948de1907ac99a7aa663 Mon Sep 17 00:00:00 2001 From: Miriam Ruiz Date: Mon, 1 Dec 2008 09:09:49 +0100 Subject: [PATCH] Fix a blit overflow if rect->x or rect->y < 0 See http://bugs.debian.org/439855 Copyright (C) 2007 Jens Seidel Patch obtained from Debian Package release 0.1.2-4 --- src/SDL_Pango.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/SDL_Pango.c b/src/SDL_Pango.c index fe67da1..590924a 100644 --- a/src/SDL_Pango.c +++ b/src/SDL_Pango.c @@ -725,16 +725,23 @@ SDLPango_CopyFTBitmapToSurface( int x = rect->x; int y = rect->y; + if(x < 0) { + width += x; x = 0; + } if(x + width > surface->w) { width = surface->w - x; - if(width <= 0) - return; + } + if(width <= 0) + return; + + if(y < 0) { + height += y; y = 0; } if(y + height > surface->h) { height = surface->h - y; - if(height <= 0) - return; } + if(height <= 0) + return; if(SDL_LockSurface(surface)) { SDL_SetError("surface lock failed"); -- 2.11.4.GIT