Skip to content

Commit 2e7df9e

Browse files
authored
ext/gd: imagefilter* using overflow checks. (#18283)
Accept up to UINT_MAX * sizeof(int) colors.
1 parent 25f4f79 commit 2e7df9e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/gd/gd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -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), 0);
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)