Properly check imagegd() signature

Unlike imagegd2(), this function only accepts two parameters,
so we should be checking for that.
This commit is contained in:
Nikita Popov 2021-02-09 15:18:59 +01:00
parent 838ae016d7
commit 57cb01a927

View file

@ -1785,8 +1785,18 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
/* The quality parameter for gd2 stands for chunk size */
if (zend_parse_parameters(argc, "O|p!ll", &imgind, gd_image_ce, &file, &file_len, &quality, &type) == FAILURE) {
RETURN_THROWS();
switch (image_type) {
case PHP_GDIMG_TYPE_GD:
if (zend_parse_parameters(argc, "O|p!", &imgind, gd_image_ce, &file, &file_len) == FAILURE) {
RETURN_THROWS();
}
break;
case PHP_GDIMG_TYPE_GD2:
if (zend_parse_parameters(argc, "O|p!ll", &imgind, gd_image_ce, &file, &file_len, &quality, &type) == FAILURE) {
RETURN_THROWS();
}
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
im = php_gd_libgdimageptr_from_zval_p(imgind);