Skip to content

Commit 74b11e3

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79068: gdTransformAffineCopy() changes interpolation method
2 parents b59f760 + 4bec59f commit 74b11e3

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ PHP NEWS
3737

3838
- GD:
3939
. Fixed bug #79067 (gdTransformAffineCopy() may use unitialized values). (cmb)
40+
. Fixed bug #79068 (gdTransformAffineCopy() changes interpolation method).
41+
(cmb)
4042

4143
- Libxml:
4244
. Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter). (Laruence)

ext/gd/libgd/gd_interpolation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2306,7 +2306,7 @@ int gdTransformAffineCopy(gdImagePtr dst,
23062306
gdPointF pt, src_pt;
23072307
gdRect bbox;
23082308
int end_x, end_y;
2309-
gdInterpolationMethod interpolation_id_bak = GD_DEFAULT;
2309+
gdInterpolationMethod interpolation_id_bak = src->interpolation_id;
23102310

23112311
/* These methods use special implementations */
23122312
if (src->interpolation_id == GD_BILINEAR_FIXED || src->interpolation_id == GD_BICUBIC_FIXED || src->interpolation_id == GD_NEAREST_NEIGHBOUR) {

ext/gd/tests/bug79068.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #79068 (gdTransformAffineCopy() changes interpolation method)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('gd')) die('skip gd extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
require_once __DIR__ . '/func.inc';
10+
11+
$src = imagecreatetruecolor(100, 100);
12+
imagefilledrectangle($src, 0, 0, 99, 99, 0xffffff);
13+
imageline($src, 10, 10, 90, 90, 0x000000);
14+
imagesetinterpolation($src, IMG_BSPLINE);
15+
imageaffine($src, [1, 1, 1, 1, 1, 1]);
16+
$dst = imagerotate($src, 80, 0xffffff);
17+
18+
test_image_equals_file(__DIR__ . '/bug79068.png', $dst);
19+
?>
20+
--EXPECT--
21+
The images are equal.

ext/gd/tests/bug79068.png

798 Bytes
Loading

0 commit comments

Comments
 (0)