mirror of
https://github.com/php/php-src.git
synced 2024-09-24 03:17:26 +00:00
fix #34996 (ImageTrueColorToPalette() crashes when ncolors is zero)
This commit is contained in:
parent
21b1f3279b
commit
5f7baf7312
@ -876,6 +876,10 @@ PHP_FUNCTION(imagetruecolortopalette)
|
||||
convert_to_boolean_ex(dither);
|
||||
convert_to_long_ex(ncolors);
|
||||
|
||||
if (Z_LVAL_PP(ncolors) <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of colors has to be greater than zero");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
gdImageTrueColorToPalette(im, Z_LVAL_PP(dither), Z_LVAL_PP(ncolors));
|
||||
|
||||
RETURN_TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user