cvs: /php4/ext/gd gd.c

From: Date: Mon, 01 May 2000 18:57:29 +0000
Subject: cvs: /php4/ext/gd gd.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-14287@lists.php.net to get a copy of this message
rasmus Mon May 1 11:57:29 2000 EDT Modified files: /php4/ext/gd gd.c Log: Dynamically allocate points for ImagePolygon (Marc Pohl) @Dynamically allocate points for ImagePolygon (Marc Pohl) Index: php4/ext/gd/gd.c diff -u php4/ext/gd/gd.c:1.52 php4/ext/gd/gd.c:1.53 --- php4/ext/gd/gd.c:1.52 Thu Apr 20 19:23:16 2000 +++ php4/ext/gd/gd.c Mon May 1 11:56:58 2000 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: gd.c,v 1.52 2000/04/21 02:23:16 rasmus Exp $ */ +/* $Id: gd.c,v 1.53 2000/05/01 18:56:58 rasmus Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -176,8 +176,6 @@ #endif -#define PolyMaxPoints 256 - static void php_free_gd_font(gdFontPtr fp) { if (fp->data) { @@ -1418,7 +1416,7 @@ zval **IM, **POINTS, **NPOINTS, **COL; pval **var = NULL; gdImagePtr im; - gdPoint points[PolyMaxPoints]; + gdPointPtr points; int npoints, col, nelem, i; GDLS_FETCH(); @@ -1464,8 +1462,9 @@ RETURN_FALSE; } - if (npoints > PolyMaxPoints) { - php_error(E_WARNING, "maximum %d points", PolyMaxPoints); + points = (gdPointPtr) emalloc(npoints * sizeof(gdPoint)); + if (points == NULL) { + php_error(E_WARNING, "ImagePolygon: Memory allocation fault"); RETURN_FALSE; } @@ -1488,6 +1487,8 @@ else { gdImagePolygon(im, points, npoints, col); } + + efree(points); RETURN_TRUE; }

« previous php.version4 (#14287) next »