diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2016-10-25 14:34:43 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2016-10-25 14:35:38 +0200 |
commit | c30e5a32c1a68f62a2356eb52965551252f8131c (patch) | |
tree | ec39ed129aa948e457ac869f8b8340d7658bb302 | |
parent | 1fd3ab4fe9f16637c2fbf8076ffbf97c62d6708f (diff) | |
parent | af4bfe234caeeb1e59953d130dc7f74a035a2de6 (diff) | |
download | php-git-c30e5a32c1a68f62a2356eb52965551252f8131c.tar.gz |
Merge branch 'PHP-7.0' into PHP-7.1
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/gd/libgd/gd_crop.c | 4 | ||||
-rw-r--r-- | ext/gd/tests/bug72494.phpt | 15 |
3 files changed, 21 insertions, 1 deletions
@@ -546,7 +546,8 @@ PHP NEWS (Pierre) . Fixed bug #72482 (Ilegal write/read access caused by gdImageAALine overflow). (Pierre) - . Fixed bug #72494 (imagecropauto out-of-bounds access). (Pierre) + . Fixed bug #72494 (imagecropauto out-of-bounds access). (Fernando, Pierre, + cmb) - Intl: . Partially fixed #72506 (idn_to_ascii for UTS #46 incorrect for long domain diff --git a/ext/gd/libgd/gd_crop.c b/ext/gd/libgd/gd_crop.c index 8331521446..58b630317d 100644 --- a/ext/gd/libgd/gd_crop.c +++ b/ext/gd/libgd/gd_crop.c @@ -243,6 +243,10 @@ gdImagePtr gdImageCropThreshold(gdImagePtr im, const unsigned int color, const f return NULL; } + if (!gdImageTrueColor(im) && color >= gdImageColorsTotal(im)) { + return NULL; + } + /* TODO: Add gdImageGetRowPtr and works with ptr at the row level * for the true color and palette images * new formats will simply work with ptr diff --git a/ext/gd/tests/bug72494.phpt b/ext/gd/tests/bug72494.phpt new file mode 100644 index 0000000000..f21de6ca3b --- /dev/null +++ b/ext/gd/tests/bug72494.phpt @@ -0,0 +1,15 @@ +--TEST--
+Bug #72494 (imagecropauto out-of-bounds access)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+$im = imagecreate(10,10);
+imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
+?>
+===DONE===
+--EXPECTF--
+Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
+===DONE===
|