Fix #79068: gdTransformAffineCopy() changes interpolation method

We port
<9088591eae>.
This commit is contained in:
Christoph M. Becker 2020-01-06 10:33:47 +01:00
parent 2c5860517c
commit 4bec59f175
4 changed files with 24 additions and 1 deletions

2
NEWS
View File

@ -25,6 +25,8 @@ PHP NEWS
. Fixed bug #78923 (Artifacts when convoluting image with transparency).
(wilson chen)
. Fixed bug #79067 (gdTransformAffineCopy() may use unitialized values). (cmb)
. Fixed bug #79068 (gdTransformAffineCopy() changes interpolation method).
(cmb)
- Libxml:
. Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter). (Laruence)

View File

@ -2351,7 +2351,7 @@ int gdTransformAffineCopy(gdImagePtr dst,
gdPointF pt, src_pt;
gdRect bbox;
int end_x, end_y;
gdInterpolationMethod interpolation_id_bak = GD_DEFAULT;
gdInterpolationMethod interpolation_id_bak = src->interpolation_id;
interpolation_method interpolation_bak;
/* These methods use special implementations */

View File

@ -0,0 +1,21 @@
--TEST--
Bug #79068 (gdTransformAffineCopy() changes interpolation method)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
require_once __DIR__ . '/func.inc';
$src = imagecreatetruecolor(100, 100);
imagefilledrectangle($src, 0, 0, 99, 99, 0xffffff);
imageline($src, 10, 10, 90, 90, 0x000000);
imagesetinterpolation($src, IMG_BSPLINE);
imageaffine($src, [1, 1, 1, 1, 1, 1]);
$dst = imagerotate($src, 80, 0xffffff);
test_image_equals_file(__DIR__ . '/bug79068.png', $dst);
?>
--EXPECT--
The images are equal.

BIN
ext/gd/tests/bug79068.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B