Skip to content

Commit ccd34f4

Browse files
committed
Fix GH-20551: imagegammacorrect out of range gamma value.
1 parent 769f319 commit ccd34f4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ext/gd/gd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,6 +2293,11 @@ PHP_FUNCTION(imagegammacorrect)
22932293

22942294
gamma = input / output;
22952295

2296+
if (UNEXPECTED(!zend_finite(gamma))) {
2297+
zend_value_error("An input divided by an output must be finite");
2298+
RETURN_THROWS();
2299+
}
2300+
22962301
im = php_gd_libgdimageptr_from_zval_p(IM);
22972302

22982303
if (gdImageTrueColor(im)) {

0 commit comments

Comments
 (0)