From 83ef6ef4ac8952a81df0c7d3894f838feade16c0 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Fri, 10 Oct 2008 00:33:22 +0000 Subject: [PATCH] (linux) Fixed a sigsegv when drawing a color brush which is completely outside screen (The only way is to use the circle tool) SDL_UpdateRect was crashing because of receiving negative Width or Height. This was due to Calculer_dimensions_clipees() clipping width or height so much that they become negative. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@222 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- graph.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graph.c b/graph.c index 1e781d51..6c24ee3e 100644 --- a/graph.c +++ b/graph.c @@ -1856,6 +1856,8 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview) Largeur=Brosse_Largeur; Hauteur=Brosse_Hauteur; Calculer_dimensions_clipees(&Debut_X,&Debut_Y,&Largeur,&Hauteur); + if (Largeur<=0 || Hauteur<=0) + break; Debut_Compteur_X=Debut_X-(X-Brosse_Decalage_X); Debut_Compteur_Y=Debut_Y-(Y-Brosse_Decalage_Y); Fin_Compteur_X=Debut_Compteur_X+Largeur;