summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2016-09-03 19:52:19 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2016-09-03 19:59:44 +0200
commit8cc9570f53926df12e85302af325d42382326bf4 (patch)
tree323259ff28a4fe95a8322c15918200d35735e929
parentc9040d43a88d21a8cfe9329c2f97400919dfc283 (diff)
parentd58224136801ce93b013079557d1de4d068b9b99 (diff)
downloadphp-git-8cc9570f53926df12e85302af325d42382326bf4.tar.gz
Merge branch 'PHP-5.6' into PHP-7.0
-rw-r--r--NEWS4
-rw-r--r--ext/gd/libgd/gd_topal.c2
-rw-r--r--ext/gd/tests/bug67325.jpegbin0 -> 13608 bytes
-rw-r--r--ext/gd/tests/bug67325.phpt29
4 files changed, 34 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 9d4b2ec60a..c26aa34fe3 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2016 PHP 7.0.12
+- GD:
+ . Fixed bug #67325 (imagetruecolortopalette: white is duplicated in palette).
+ (cmb)
+
- mbstring:
. Fixed bug #66797 (mb_substr only takes 32-bit signed integer). (cmb)
diff --git a/ext/gd/libgd/gd_topal.c b/ext/gd/libgd/gd_topal.c
index d8dda45cb9..896c3cb948 100644
--- a/ext/gd/libgd/gd_topal.c
+++ b/ext/gd/libgd/gd_topal.c
@@ -760,7 +760,7 @@ LOCAL (void)
cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total >> 1)) / total);
#else
/* 2.0.16: Paul den Dulk found an occasion where total can be 0 */
- if (count)
+ if (total)
{
nim->red[icolor] = (int) ((c0total + (total >> 1)) / total);
nim->green[icolor] = (int) ((c1total + (total >> 1)) / total);
diff --git a/ext/gd/tests/bug67325.jpeg b/ext/gd/tests/bug67325.jpeg
new file mode 100644
index 0000000000..82e8233a76
--- /dev/null
+++ b/ext/gd/tests/bug67325.jpeg
Binary files differ
diff --git a/ext/gd/tests/bug67325.phpt b/ext/gd/tests/bug67325.phpt
new file mode 100644
index 0000000000..dabc8b2b30
--- /dev/null
+++ b/ext/gd/tests/bug67325.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #67325 (imagetruecolortopalette: white is duplicated in palette)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+if (!(imagetypes() & IMG_JPG)) die('skip JPEG support not available');
+?>
+--FILE--
+<?php
+$filename = __DIR__ . DIRECTORY_SEPARATOR . 'bug67325.jpeg';
+
+$im = imagecreatefromjpeg($filename);
+imagetruecolortopalette($im, 0, 256);
+
+$white = 0;
+for ($i = 0; $i < 256; $i++) {
+ $components = imagecolorsforindex($im, $i);
+ if ($components['red'] === 255 && $components['green'] === 255 && $components['blue'] === 255) {
+ $white++;
+ }
+}
+var_dump($white);
+
+imagedestroy($im);
+?>
+===DONE===
+--EXPECT--
+int(0)
+===DONE===