Christoph M. Becker
d50532be91
Fix #81739 : OOB read due to insufficient validation in imageloadfont()
...
If we swap the byte order of the relevant header bytes, we need to make
sure again that the following multiplication does not overflow.
2022-10-23 18:41:48 -06:00
Christoph M. Becker
526407ca35
Fix #53580 : During resize gdImageCopyResampled cause colors change
...
We port the upstream fix[1], and also revert commit a3383ac3d7[2] which
is now obsolete, and also not part of libgd. Especially the change to
gd.png.c was at best a half-baked optimization.
[1] <a24e96f019 >
[2] <a3383ac3d7 >
Closes GH-7402.
2021-08-26 18:38:17 +02:00
Christoph M. Becker
c565555f03
Fix #51498 : imagefilledellipse does not work for large circles
...
We backport the respective upstream fix[1].
[1] <ace7fd88dc >
Closes GH-7329.
2021-08-03 16:17:47 +02:00
Christoph M. Becker
ff7fd3dc85
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix #79676 : imagescale adds black border with IMG_BICUBIC
2020-06-12 14:07:43 +02:00
Christoph M. Becker
86e1f0ea11
Fix #79676 : imagescale adds black border with IMG_BICUBIC
...
We have to loop over all image pixels to avoid the black border. This
is also done in external libgd in `_gdScaleOneAxis` and `_gdScalePass`.
2020-06-12 14:05:54 +02:00
Christoph M. Becker
da801ba5e3
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix #79615 : Wrong GIF header written in GD GIFEncode
2020-05-22 09:19:05 +02:00
Christoph M. Becker
d4bd6fb491
Fix #79615 : Wrong GIF header written in GD GIFEncode
...
The color resolution is expected in bits 4-6 of the packed fields byte
of the logical screen descriptor (byte 10 of the GIF data stream),
according to the specification[1], section 18.
[1] <https://www.w3.org/Graphics/GIF/spec-gif89a.txt >
2020-05-22 09:15:41 +02:00
Christoph M. Becker
74b11e3315
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix #79068 : gdTransformAffineCopy() changes interpolation method
2020-01-06 10:38:22 +01:00
Christoph M. Becker
4bec59f175
Fix #79068 : gdTransformAffineCopy() changes interpolation method
...
We port
<9088591eae >.
2020-01-06 10:36:48 +01:00
Christoph M. Becker
f799f42ec8
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix #79067 : gdTransformAffineCopy() may use unitialized values
2020-01-06 09:37:40 +01:00
Christoph M. Becker
2c5860517c
Fix #79067 : gdTransformAffineCopy() may use unitialized values
...
We port
<7a06c1669c >.
2020-01-06 09:35:13 +01:00
Christoph M. Becker
aba070e630
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix #78923 : Artifacts when convoluting image with transparency
2019-12-07 12:08:30 +01:00
willson-chen
b5d2cbe027
Fix #78923 : Artifacts when convoluting image with transparency
...
We have to properly initialize `pxl` before using it.
Fix ported from <https://github.com/libgd/libgd/pull/559 >.
2019-12-07 12:06:33 +01:00
Christoph M. Becker
73f29a5c5e
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Add missing skip keyword in tests
2019-10-01 11:17:53 +02:00
Christoph M. Becker
2fc5d00afa
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Add missing skip keyword in tests
2019-10-01 11:15:12 +02:00
Fabien Villepinte
209e37db7d
Add missing skip keyword in tests
2019-10-01 11:13:36 +02:00
Fabien Villepinte
0aa3acc6c4
Fix borked SKIPIFs
2019-09-30 17:51:41 +02:00
Christoph M. Becker
81fd113506
Support TGA reading
...
We add PHP bindings for libgd's features to read TGA files, which are
available as of libgd 2.1.0.
As PHP's bundled libgd doesn't yet include the respective features of the
external libgd, we add these.
Since TGA has no easily recognizable file signature, we don't add TGA
support for imagecreatefromstring() or getimagesize() and friends.
2019-06-20 23:40:51 +02:00
Nikita Popov
4488475a3e
imagecolorallocate(): Check that RGB components are in-range
...
Instead of letting them bleed over into other components.
2019-06-20 10:09:54 +02:00
Christoph M. Becker
37d0c7b0e4
Simplify GD null byte injection tests
...
These tests actually check that no file with a name containing a NUL is
created by the GD image output functions. This is superfluous, since
it is sufficient to check that the function failed, and that an
appropriate warning has been raised.
We also add missing nullbyte injection tests.
2019-06-12 12:04:01 +02:00
Joe Watkins
2dfa495311
fix flaky gd tests
2019-06-12 07:52:28 +02:00
Stanislav Malyshev
5e3dc08826
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Update NEWS
Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow
Fix #77973 : Uninitialized read in gdImageCreateFromXbm
2019-05-27 16:49:31 -07:00
Stanislav Malyshev
c7eb0feed8
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Update NEWS
Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow
Fix #77973 : Uninitialized read in gdImageCreateFromXbm
2019-05-27 16:49:25 -07:00
Stanislav Malyshev
e77c8e45ba
Merge branch 'PHP-7.1' into PHP-7.2
...
* PHP-7.1:
Update NEWS
Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow
Fix #77973 : Uninitialized read in gdImageCreateFromXbm
2019-05-27 16:49:19 -07:00
Christoph M. Becker
ed6dee9a19
Fix #77973 : Uninitialized read in gdImageCreateFromXbm
...
We have to ensure that `sscanf()` does indeed read a hex value here,
and bail out otherwise.
2019-05-27 16:11:32 -07:00
Peter Kokot
a68e0767b3
Rename *.jpeg files to *.jpg
...
These file extensions are not part of these tests and *.jpg is more
common.
2019-05-11 03:22:19 +02:00
Kalle Sommer Nielsen
bcd11a1dfb
Implemented the gdScatter filter I wrote almost 10 years ago
...
This filter is available as of libgd 2.1.0 which is our bare minimum for
external compilation of ext/gd.
The scatter filter works by iterating over all pixels in the image and
shifting them randomly based on two modifier (`plus` and `sub`) values:
dest_x = (int)(x + ((rand() % (plus - sub)) + sub));
dest_y = (int)(y + ((rand() % (plus - sub)) + sub));
Additionally the scatter filter also supports by only shifting pixels where
the current pixel being iterated is one or more colors, allowing the scatter
filter to only effect solid colors in part of an image.
Note, due to the nature of randomness and implementation, pixels who were
shifted ahead of iteration will be shifted once more and therefore the
bottom right of an image may contain a slight scatter effect due to this.
2019-05-10 02:23:40 +03:00
Christoph M. Becker
3891e0d13a
Add tests for bug77943
2019-04-29 16:29:08 +02:00
Christoph M. Becker
85cf1cb077
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix #77943 : imageantialias($image, false); does not work
2019-04-29 16:18:54 +02:00
Christoph M. Becker
3fc1bdc81c
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Fix #77943 : imageantialias($image, false); does not work
2019-04-29 16:18:27 +02:00
Christoph M. Becker
cd94cf60a2
Fix #77943 : imageantialias($image, false); does not work
...
Firstly, we must not call `gdImageSetAntiAliased()` (which sets the
color to anti-alias), but rather modify the `gdImage.AA` flag.
Furthermore, we have to actually use the supplied boolean value.
We also make sure that we don't attempt to enable anti-aliasing for
palette images.
2019-04-29 16:16:46 +02:00
Rodrigo Prado
ba0f7f7e43
Added test for imagecolorclosesthwb
...
The function was not tested yet.
See http://gcov.php.net/viewer.php?version=PHP_HEAD&func=tested_functions
2019-04-20 19:31:45 +02:00
Fabien Villepinte
26dfce7f36
Replace dirname(__FILE__) by __DIR__ in tests
2019-03-15 22:55:30 +01:00
Christoph M. Becker
f651397b1f
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix #77700 : Writing truecolor images as GIF ignores interlace flag
2019-03-06 00:38:12 +01:00
Christoph M. Becker
0d88388912
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Fix #77700 : Writing truecolor images as GIF ignores interlace flag
2019-03-06 00:37:38 +01:00
Christoph M. Becker
41fb0eaa11
Fix #77700 : Writing truecolor images as GIF ignores interlace flag
...
We revert the interlace flag related part of commit ff2822a[1], since
contrary to the transparent color, the interlace flag is not retained
by `gdImageCreatePaletteFromTrueColor()`. This also matches upstream
libgd.
[1] <http://git.php.net/?p=php-src.git;a=commit;h=ff2822a82b740edb8ccf307f080bae188c200fb9 >
2019-03-06 00:34:40 +01:00
Nikita Popov
7e3f4a2390
Remove more zpp error/variation tests
2019-03-05 14:09:33 +01:00
Nikita Popov
e27ba75e0f
Use separate output files in x2gd tests
2019-03-04 10:48:09 +01:00
BlackEagle
a8336fb7b9
gd imageloadfont, verify error while reading header
...
when reading the header verify we get an error when the header is
invalid.
Signed-off-by: BlackEagle <ike.devolder@gmail.com >
2019-02-19 03:26:00 +01:00
BlackEagle
fee9f3a8f4
gd imageloadfont test while reading header
...
Cover error when the header of an gd font loading is interrupted by end
of file.
Signed-off-by: BlackEagle <ike.devolder@gmail.com >
2019-02-14 22:29:35 +01:00
Nikita Popov
8bc663f43b
Remove zpp variation tests
2019-02-05 09:38:55 +01:00
Christoph M. Becker
6aff4d01c7
Merge branch 'PHP-7.3'
...
* PHP-7.3:
Fix failing test
2019-01-19 11:21:07 +01:00
Christoph M. Becker
2966da70cf
Fix failing test
2019-01-19 11:13:13 +01:00
Christoph M. Becker
387c45a9bb
Merge branch 'PHP-7.3'
...
* PHP-7.3:
Fix #77479 : imagewbmp() segfaults with very large images
2019-01-19 10:18:55 +01:00
Christoph M. Becker
1907cbd8b3
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Fix #77479 : imagewbmp() segfaults with very large images
2019-01-19 10:18:20 +01:00
Christoph M. Becker
44fa0b0f31
Fix #77479 : imagewbmp() segfaults with very large images
...
We must not proceed working with the Wbmp structure, if it hasn't been
allocated.
2019-01-19 10:16:02 +01:00
Christoph M. Becker
6d11d8d3ed
Merge branch 'PHP-7.3'
...
* PHP-7.3:
Fix #73614 : gdImageFilledArc() doesn't properly draw pies
2019-01-16 20:23:17 +01:00
Christoph M. Becker
26b5aa8584
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Fix #73614 : gdImageFilledArc() doesn't properly draw pies
2019-01-16 20:22:37 +01:00
Christoph M. Becker
61cfa34e11
Fix #73614 : gdImageFilledArc() doesn't properly draw pies
...
The fix for PHP bug 43828[1] changed the algorithm from drawing filled
pies from drawing multiple triangles to drawing a single polygon. Due
to quirks of the filled polygon drawing algorithm, we had to filter out
extraneous vertices. This lead, however, to a bug regarding displaced
starting and ending points near 90° and 270° degrees, which we fix by
reinserting these vertices if they had been removed.
This fix is a port of libgd/libgd@1406b1a .
[1] <https://bugs.php.net/bug.php?id=43828 >
2019-01-16 20:10:04 +01:00
Christoph M. Becker
d1f3746c94
Merge branch 'PHP-7.3'
...
* PHP-7.3:
Fix #73281 : imagescale(…, IMG_BILINEAR_FIXED) can cause black border
2019-01-10 16:28:43 +01:00