summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwillson-chen <willson.chenwx@gmail.com>2019-12-07 10:56:37 +0800
committerChristoph M. Becker <cmbecker69@gmx.de>2019-12-07 12:06:33 +0100
commitb5d2cbe02739a0c9b16e7b37ce44e71d1d657daa (patch)
tree3e0437d0be2f51ae9fdfc1deb7328517cba3edef
parent249e49092d0e7f4b38a83e59947797d4e255991f (diff)
downloadphp-git-b5d2cbe02739a0c9b16e7b37ce44e71d1d657daa.tar.gz
Fix #78923: Artifacts when convoluting image with transparency
We have to properly initialize `pxl` before using it. Fix ported from <https://github.com/libgd/libgd/pull/559>.
-rw-r--r--NEWS4
-rw-r--r--ext/gd/libgd/gd_filter.c1
-rw-r--r--ext/gd/tests/bug47946.phpt4
-rw-r--r--ext/gd/tests/bug47946_exp.pngbin396 -> 355 bytes
4 files changed, 6 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index e5feaa48ce..7a8d3908fb 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.14
+- GD:
+ . Fixed bug #78923 (Artifacts when convoluting image with transparency).
+ (wilson chen)
+
19 Dec 2019, PHP 7.3.13
- Core:
diff --git a/ext/gd/libgd/gd_filter.c b/ext/gd/libgd/gd_filter.c
index fc48cd08de..e132b494dc 100644
--- a/ext/gd/libgd/gd_filter.c
+++ b/ext/gd/libgd/gd_filter.c
@@ -264,6 +264,7 @@ int gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, flo
for ( y=0; y<src->sy; y++) {
for(x=0; x<src->sx; x++) {
new_r = new_g = new_b = 0;
+ pxl = f(srcback, x, y);
new_a = gdImageAlpha(srcback, pxl);
for (j=0; j<3; j++) {
diff --git a/ext/gd/tests/bug47946.phpt b/ext/gd/tests/bug47946.phpt
index aeea7fb324..c329094863 100644
--- a/ext/gd/tests/bug47946.phpt
+++ b/ext/gd/tests/bug47946.phpt
@@ -1,11 +1,9 @@
--TEST--
Bug #47946 (ImageConvolution overwrites background)
---DESCRIPTION--
-The expected image has black pixel artifacts, what is another issue, though
-(perhaps #40158).
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
+if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstream fix not yet released');
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug47946_exp.png b/ext/gd/tests/bug47946_exp.png
index 7eb462dd88..4c69a9eea3 100644
--- a/ext/gd/tests/bug47946_exp.png
+++ b/ext/gd/tests/bug47946_exp.png
Binary files differ