diff options
author | willson-chen <willson.chenwx@gmail.com> | 2019-12-07 10:56:37 +0800 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-12-07 12:06:33 +0100 |
commit | b5d2cbe02739a0c9b16e7b37ce44e71d1d657daa (patch) | |
tree | 3e0437d0be2f51ae9fdfc1deb7328517cba3edef | |
parent | 249e49092d0e7f4b38a83e59947797d4e255991f (diff) | |
download | php-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-- | NEWS | 4 | ||||
-rw-r--r-- | ext/gd/libgd/gd_filter.c | 1 | ||||
-rw-r--r-- | ext/gd/tests/bug47946.phpt | 4 | ||||
-rw-r--r-- | ext/gd/tests/bug47946_exp.png | bin | 396 -> 355 bytes |
4 files changed, 6 insertions, 3 deletions
@@ -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 Binary files differindex 7eb462dd88..4c69a9eea3 100644 --- a/ext/gd/tests/bug47946_exp.png +++ b/ext/gd/tests/bug47946_exp.png |