Skip to content

Commit b5d2cbe

Browse files
willson-chencmb69
authored andcommitted
Fix #78923: Artifacts when convoluting image with transparency
We have to properly initialize `pxl` before using it. Fix ported from <libgd/libgd#559>.
1 parent 249e490 commit b5d2cbe

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.3.14
44

5+
- GD:
6+
. Fixed bug #78923 (Artifacts when convoluting image with transparency).
7+
(wilson chen)
8+
59
19 Dec 2019, PHP 7.3.13
610

711
- Core:

ext/gd/libgd/gd_filter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ int gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, flo
264264
for ( y=0; y<src->sy; y++) {
265265
for(x=0; x<src->sx; x++) {
266266
new_r = new_g = new_b = 0;
267+
pxl = f(srcback, x, y);
267268
new_a = gdImageAlpha(srcback, pxl);
268269

269270
for (j=0; j<3; j++) {

ext/gd/tests/bug47946.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
--TEST--
22
Bug #47946 (ImageConvolution overwrites background)
3-
--DESCRIPTION--
4-
The expected image has black pixel artifacts, what is another issue, though
5-
(perhaps #40158).
63
--SKIPIF--
74
<?php
85
if (!extension_loaded('gd')) die('skip gd extension not available');
6+
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstream fix not yet released');
97
?>
108
--FILE--
119
<?php

ext/gd/tests/bug47946_exp.png

-41 Bytes
Loading

0 commit comments

Comments
 (0)