summaryrefslogtreecommitdiff
path: root/ext/gd
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd')
-rw-r--r--ext/gd/gd.c4
-rw-r--r--ext/gd/libgd/gd.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 51b0d03044..8b8d8aa974 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -762,7 +762,7 @@ PHP_FUNCTION(imagesetstyle)
convert_to_array_ex(styles);
/* copy the style values in the stylearr */
- stylearr = emalloc(sizeof(int) * zend_hash_num_elements(HASH_OF(*styles)));
+ stylearr = safe_emalloc(sizeof(int), zend_hash_num_elements(HASH_OF(*styles)), 0);
zend_hash_internal_pointer_reset_ex(HASH_OF(*styles), &pos);
@@ -2572,7 +2572,7 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
RETURN_FALSE;
}
- points = (gdPointPtr) emalloc(npoints * sizeof(gdPoint));
+ points = (gdPointPtr) safe_emalloc(npoints, sizeof(gdPoint), 0);
for (i = 0; i < npoints; i++) {
if (zend_hash_index_find(Z_ARRVAL_PP(POINTS), (i * 2), (void **) &var) == SUCCESS) {
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index fcfd249f60..4598081f40 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -1873,7 +1873,7 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc)
oc = gdImageGetPixel(im, x, y);
if (oc==nc || x<0 || x>wx2 || y<0 || y>wy2) return;
- stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)+1);
+ stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1);
sp = stack;
/* required! */
@@ -1938,7 +1938,7 @@ void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
pts[i] = (int *) ecalloc(im->sx, sizeof(int));
}
- stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)+1);
+ stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1);
sp = stack;
oc = gdImageGetPixel(im, x, y);