cvs: gd /libgd gd.c

From: Date: Fri, 05 Jan 2007 04:11:10 +0000
Subject: cvs: gd /libgd gd.c
Groups: php.gd.cvs 
Request: Send a blank email to php-gd-cvs+get-80@lists.php.net to get a copy of this message
pajoye Fri Jan 5 04:11:10 2007 UTC Modified files: /gd/libgd gd.c Log: - add sanity checks for alloc error in gdImageFill http://cvs.php.net/viewvc.cgi/gd/libgd/gd.c?r1=1.45&r2=1.46&diff_format=u Index: gd/libgd/gd.c diff -u gd/libgd/gd.c:1.45 gd/libgd/gd.c:1.46 --- gd/libgd/gd.c:1.45 Thu Jan 4 12:36:40 2007 +++ gd/libgd/gd.c Fri Jan 5 04:11:10 2007 @@ -1,4 +1,4 @@ -/* $Id: gd.c,v 1.45 2007/01/04 12:36:40 pajoye Exp $ */ +/* $Id: gd.c,v 1.46 2007/01/05 04:11:10 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -1775,8 +1775,9 @@ srcx = x % gdImageSX(im->tile); srcy = y % gdImageSY(im->tile); p = gdImageGetPixel(im->tile, srcx, srcy); - - if (im->trueColor) { + if (p == im->tile->transparent) { + tileColor = im->transparent; + } else if (im->trueColor) { if (im->tile->trueColor) { tileColor = p; } else { @@ -1821,7 +1822,7 @@ struct seg *stack; struct seg *sp; - if (!im->trueColor && nc > im->colorsTotal) { + if (!im->trueColor && nc > (im->colorsTotal - 1)) { return; } @@ -1841,6 +1842,9 @@ } stack = (struct seg *)gdMalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)); + if (!stack) { + return; + } sp = stack; /* required! */ @@ -1907,6 +1911,9 @@ } stack = (struct seg *)gdMalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)); + if (!stack) { + return; + } sp = stack; oc = gdImageGetPixel(im, x, y);

« previous php.gd.cvs (#80) next »