diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-01-06 10:33:47 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-01-06 10:36:48 +0100 |
commit | 4bec59f1751d9d1e302465b68cceffb8df93a7be (patch) | |
tree | 3c40cee9d88c74d27b519c5bc833e77e25c4fd8c | |
parent | 2c5860517c4a1f7ebc81ef79858aa5aff5aad76c (diff) | |
download | php-git-4bec59f1751d9d1e302465b68cceffb8df93a7be.tar.gz |
Fix #79068: gdTransformAffineCopy() changes interpolation method
We port
<https://github.com/libgd/libgd/commit/9088591eae437358ee5b929adf82865e37e3001e>.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/gd/libgd/gd_interpolation.c | 2 | ||||
-rw-r--r-- | ext/gd/tests/bug79068.phpt | 21 | ||||
-rw-r--r-- | ext/gd/tests/bug79068.png | bin | 0 -> 798 bytes |
4 files changed, 24 insertions, 1 deletions
@@ -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) diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c index 489f3c9694..d723e652a8 100644 --- a/ext/gd/libgd/gd_interpolation.c +++ b/ext/gd/libgd/gd_interpolation.c @@ -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 index 0000000000..391424b119 --- /dev/null +++ b/ext/gd/tests/bug79068.phpt @@ -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 Binary files differnew file mode 100644 index 0000000000..805edc1c56 --- /dev/null +++ b/ext/gd/tests/bug79068.png |