]> granicus.if.org Git - php/commitdiff
Fix #79068: gdTransformAffineCopy() changes interpolation method
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 6 Jan 2020 09:33:47 +0000 (10:33 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 6 Jan 2020 09:36:48 +0000 (10:36 +0100)
We port
<https://github.com/libgd/libgd/commit/9088591eae437358ee5b929adf82865e37e3001e>.

NEWS
ext/gd/libgd/gd_interpolation.c
ext/gd/tests/bug79068.phpt [new file with mode: 0644]
ext/gd/tests/bug79068.png [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index bb7dd649db2192c8ea9d89506e06f38752c4446f..08f0f5b2db46a2c920abe67808d735ec15094037 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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)
index 489f3c96949dae77770bfc329531489f24a33fd7..d723e652a83e669a4d8a68c8c578fc191065bca5 100644 (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 */
diff --git a/ext/gd/tests/bug79068.phpt b/ext/gd/tests/bug79068.phpt
new file mode 100644 (file)
index 0000000..391424b
--- /dev/null
@@ -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.
diff --git a/ext/gd/tests/bug79068.png b/ext/gd/tests/bug79068.png
new file mode 100644 (file)
index 0000000..805edc1
Binary files /dev/null and b/ext/gd/tests/bug79068.png differ