summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2016-07-19 18:23:51 +0700
committerAnatol Belski <ab@php.net>2016-07-19 18:38:35 +0200
commitfcb85af809a19284449d8d3e53ccde56b845f759 (patch)
tree027788a5591125b440483449e482d22918d3e742
parent114d5a3f48670055bc2fdddc45870d5b01e7400d (diff)
downloadphp-git-fcb85af809a19284449d8d3e53ccde56b845f759.tar.gz
fix #72494, improve input color check and prevent issues when old gd are used, done before gd call
(cherry picked from commit 1d69028d2f15216d128b5a6e606f763ef09d4991)
-rw-r--r--ext/gd/gd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index b09990938d..a1ddd42bf5 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -4617,7 +4617,7 @@ PHP_FUNCTION(imagecropauto)
break;
case GD_CROP_THRESHOLD:
- if (color < 0) {
+ if (color < 0 || (!gdImageTrueColor(im) && color >= gdImageColorsTotal(im))) {
php_error_docref(NULL, E_WARNING, "Color argument missing with threshold mode");
RETURN_FALSE;
}