com php-src: Fix #78923: Artifacts when convoluting image with transparency: NEWS ext/gd/libgd/gd_filter.c ext/gd/tests/ bug47946.phpt
ext/gd/tests/bug47946_e xp.png
| From: | Christoph Michael Becker | Date: | Sat, 07 Dec 2019 11:06:33 +0000 |
| Subject: | com php-src: Fix #78923: Artifacts when convoluting image with transparency: NEWS ext/gd/libgd/gd_filter.c ext/gd/tests/ bug47946.phpt ext/gd/tests/bug47946_e xp.png |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109416@lists.php.net to get a copy of this message | ||
Commit: b5d2cbe02739a0c9b16e7b37ce44e71d1d657daa
Author: willson-chen <willson.chenwx@gmail.com> Sat, 7 Dec 2019 10:56:37 +0800
Committer: Christoph M. Becker <cmbecker69@gmx.de> Sat, 7 Dec 2019 12:06:33 +0100
Parents: 249e49092d0e7f4b38a83e59947797d4e255991f
Branches: PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b5d2cbe02739a0c9b16e7b37ce44e71d1d657daa
Log:
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>.
Bugs:
https://bugs.php.net/78923
Changed paths:
M NEWS
M ext/gd/libgd/gd_filter.c
M ext/gd/tests/bug47946.phpt
M ext/gd/tests/bug47946_exp.png
Diff:
diff --git a/NEWS b/NEWS
index e5feaa48cee..7a8d3908fb8 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 fc48cd08de4..e132b494dc6 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 aeea7fb324f..c329094863e 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 7eb462dd883..4c69a9eea3f 100644
Binary files a/ext/gd/tests/bug47946_exp.png and b/ext/gd/tests/bug47946_exp.png differ