Skip to content

Commit ffb3cb6

Browse files
committed
ext/gd: imagefilter* using overflow checks.
Accept up to UINT_MAX * sizeof(int) colors.
1 parent aa0c54d commit ffb3cb6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: ext/gd/gd.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ PHP_FUNCTION(imagesetstyle)
648648
}
649649

650650
/* copy the style values in the stylearr */
651-
stylearr = safe_emalloc(num_styles, sizeof(int), 0);
651+
stylearr = safe_emalloc(num_styles * sizeof(int), false);
652652

653653
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(styles), item) {
654654
stylearr[index++] = zval_get_long(item);
@@ -3599,7 +3599,7 @@ static void php_image_filter_scatter(INTERNAL_FUNCTION_PARAMETERS)
35993599
RETURN_BOOL(gdImageScatter(im, (int)scatter_sub, (int)scatter_plus));
36003600
}
36013601

3602-
colors = emalloc(num_colors * sizeof(int));
3602+
colors = safe_emalloc(num_colors * sizeof(int), false);
36033603

36043604
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(hash_colors), color) {
36053605
*(colors + i++) = (int) zval_get_long(color);

0 commit comments

Comments
 (0)