@@ -3645,6 +3645,16 @@ static void php_image_filter_scatter(INTERNAL_FUNCTION_PARAMETERS)
36453645 Z_PARAM_ARRAY (hash_colors )
36463646 ZEND_PARSE_PARAMETERS_END ();
36473647
3648+ if (scatter_sub < 0 || ZEND_SIZE_T_INT_OVFL (scatter_sub )) {
3649+ zend_argument_value_error (3 , "must be between 0 and %d" , INT_MAX );
3650+ RETURN_THROWS ();
3651+ }
3652+
3653+ if (scatter_plus < 0 || ZEND_SIZE_T_INT_OVFL (scatter_plus )) {
3654+ zend_argument_value_error (4 , "must be between 0 and %d" , INT_MAX );
3655+ RETURN_THROWS ();
3656+ }
3657+
36483658 im = php_gd_libgdimageptr_from_zval_p (IM );
36493659
36503660 if (hash_colors ) {
@@ -3939,6 +3949,12 @@ PHP_FUNCTION(imagescale)
39393949 Z_PARAM_LONG (tmp_h )
39403950 Z_PARAM_LONG (tmp_m )
39413951 ZEND_PARSE_PARAMETERS_END ();
3952+
3953+ if (tmp_m < GD_DEFAULT || tmp_m >= GD_METHOD_COUNT ) {
3954+ zend_argument_value_error (4 , "must be one of the GD_* constants" );
3955+ RETURN_THROWS ();
3956+ }
3957+
39423958 method = tmp_m ;
39433959
39443960 im = php_gd_libgdimageptr_from_zval_p (IM );
@@ -3958,10 +3974,17 @@ PHP_FUNCTION(imagescale)
39583974 }
39593975 }
39603976
3961- if (tmp_h <= 0 || tmp_h > INT_MAX || tmp_w <= 0 || tmp_w > INT_MAX ) {
3962- RETURN_FALSE ;
3977+ if (tmp_w <= 0 || ZEND_SIZE_T_INT_OVFL (tmp_w )) {
3978+ zend_argument_value_error (2 , "must be between 1 and %d" , INT_MAX );
3979+ RETURN_THROWS ();
39633980 }
39643981
3982+ if (tmp_h <= 0 || ZEND_SIZE_T_INT_OVFL (tmp_h )) {
3983+ zend_argument_value_error (3 , "must be between 1 and %d" , INT_MAX );
3984+ RETURN_THROWS ();
3985+ }
3986+
3987+
39653988 new_width = tmp_w ;
39663989 new_height = tmp_h ;
39673990
0 commit comments