1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/gd: imagefilter* using overflow checks. (#18283)

Accept up to UINT_MAX * sizeof(int) colors.
This commit is contained in:
David CARLIER
2025-04-19 16:27:14 +01:00
committed by GitHub
parent 25f4f7982c
commit 2e7df9e423

View File

@@ -3599,7 +3599,7 @@ static void php_image_filter_scatter(INTERNAL_FUNCTION_PARAMETERS)
RETURN_BOOL(gdImageScatter(im, (int)scatter_sub, (int)scatter_plus));
}
colors = emalloc(num_colors * sizeof(int));
colors = safe_emalloc(num_colors, sizeof(int), 0);
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(hash_colors), color) {
*(colors + i++) = (int) zval_get_long(color);