Fix crash when SDLPango_Draw is called with an empty string
authorMiriam Ruiz <miriam@debian.org>
Mon, 1 Dec 2008 08:08:18 +0000 (1 09:08 +0100)
committerMiriam Ruiz <miriam@debian.org>
Mon, 1 Dec 2008 08:08:18 +0000 (1 09:08 +0100)
See http://bugs.debian.org/439071
Copyright (C) 2007 Jens Seidel <jensseidel@users.sf.net>
Patch obtained from Debian Package release 0.1.2-4

src/SDL_Pango.c

index 1b304cd..fe67da1 100644 (file)
@@ -932,7 +932,9 @@ SDLPango_Draw(
     width = PANGO_PIXELS (logical_rect.width);\r
     height = PANGO_PIXELS (logical_rect.height);\r
 \r
-    SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, 0, 0, 0, 0));\r
+    if (width && height) {\r
+        SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, 0, 0, 0, 0));\r
+    }\r
 \r
     if((! context->tmp_ftbitmap) || context->tmp_ftbitmap->width < width\r
        || context->tmp_ftbitmap->rows < height)\r