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
1919c4b44d
Fix #71316 : libpng warning from imagecreatefromstring
...
We backport the respective upstream fix[1] to our bundled libgd.
[1] <636100b928 >
Closes GH-7615.
2021-11-04 11:16:45 +01:00
Michael Voříšek
2c3dfe5160
Fix gdAlphaMax limit typo
...
Closes GH-7410.
2021-09-23 23:16:40 +02: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
Flavio Heleno
28e7addb9d
Fix #81032 : GD install is affected by external libgd installation
...
This PR replaces the bundled libgd includes from #include <foo.h> with
#include "foo.h" for gd-related headers to avoid including headers that
may be available in system directories instead of the expected local
headers.
Closes GH-6975.
2021-05-14 12:24:45 +02:00
Christoph M. Becker
5dd1877ca1
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix potential integer overflow detected by oss-fuzz
2020-08-24 17:36:50 +02:00
Christoph M. Becker
74de17f2ea
Fix potential integer overflow detected by oss-fuzz
...
We port the respective fix from upstream[1].
[1] <9ed642764c >
2020-08-24 17:35:04 +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
Dmitry Stogov
92c23e1fd3
Call zend_unregister_ini_entries() when unload extension loaded through dl() without MSHUTDOWN callback.
...
Extensions with MSHUTDOWN should use UNREGISTER_INI_ENTRIES().
2019-12-09 15:05:24 +03: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
b78ec58f09
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix #78849 : GD build broken with -D SIGNED_COMPARE_SLOW
2019-11-21 10:02:33 +01:00
Christoph M. Becker
b4f501d5a4
Merge branch 'PHP-7.2' into PHP-7.3
...
* PHP-7.2:
Fix #78849 : GD build broken with -D SIGNED_COMPARE_SLOW
2019-11-21 10:01:05 +01:00
Christoph M. Becker
9b92c1d154
Fix #78849 : GD build broken with -D SIGNED_COMPARE_SLOW
...
Apparently, this has not been tested for a long time, and might be a
refactoring relict. Anyhow, we have to pass the context to
`GIFNextPixel` as well.
2019-11-21 09:59:26 +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
9818f863c3
Fix parameter order
...
`imagecopymerge()` and `imagecopymergegray()` expect the destination
image first, not the other way round.
2019-08-11 16:16:39 +02:00
Christoph M. Becker
092571c1cb
Extend color component range checks
...
We also check for alpha components to be within range, and we add yet
missing range checks for other functions as well.
2019-08-11 15:21:05 +02:00
Nikita Popov
d59aac58b3
Report errors from stream read and write operations
...
The php_stream_read() and php_stream_write() functions now return
an ssize_t value, with negative results indicating failure. Functions
like fread() and fwrite() will return false in that case.
As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams
should not be regarded as error conditions, and be reported as
successful zero-length reads/writes instead. The handling of EINTR
remains unclear and is internally inconsistent (e.g. some code-paths
will automatically retry on EINTR, while some won't).
I'm landing this now to make sure the stream wrapper ops API changes
make it into 7.4 -- however, if the user-facing changes turn out to
be problematic we have the option of clamping negative returns to
zero in php_stream_read() and php_stream_write() to restore the
old behavior in a relatively non-intrusive manner.
2019-07-22 17:17:28 +02:00
Remi Collet
31d85b8417
cleanup gd build with system libgd - drop need to use libpng with system libgd - drop need to use libjpeg with system libgd - drop need to use libXpm with system libgd - drop need to use libfreetype with system libgd - improve configure comments
2019-07-22 16:14:19 +02:00
Christoph M. Becker
f8202b5513
Remove superfluous HAVE_GD_BUNDLED checks
...
If we're compiling the bundled libgd, `HAVE_GD_BUNDLED` is set, so
there is no need to check for this macro again.
2019-07-22 15:59:44 +02:00
Christoph M. Becker
d3d3404db7
Drop superfluous ENABLE_GD_TTF
...
If we `HAVE_LIBFREETYPE`, we define `ENABLE_GD_TTF` if it is not
defined. Therefore we can check for `HAVE_LIBFREETYPE` in the first
place.
2019-07-22 12:01:24 +02:00
Remi Collet
fff6b18657
improve temporary fix for system libgd
...
- PHP_GD_PNG needed to set include path for png.h
- PHP_GD_JPEG needed to set include path for jpeglib.h
2019-07-22 09:11:32 +02:00
Remi Collet
a85e4d5336
Fixed bug #78314 (missing freetype support/functions with external gd)
2019-07-20 07:57:13 +02:00
Nikita Popov
290e520c03
Use ZEND_HASH_FOREACH APIs in a few more places
2019-07-16 12:20:16 +02:00
Peter Kokot
48abed7fd8
Use e.g. instead of less common f.e. [ci skip]
2019-07-09 17:53:46 +02:00
Peter Kokot
a014e50513
Remove HAVE_ERRNO_H from libgd
...
The check for errno.h has been removed via
50b9ef8d94
Upstream libgd library is also patched via
1e7f93922f
2019-06-28 20:02:11 +02:00
Christoph M. Becker
eec5d2a25f
Properly shut down font cache mutex
...
Since the font cache mutex in set up in MINIT, we have to shut it down
in MSHUTDOWN.
2019-06-21 16:00:47 +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
Nikita Popov
9b3b07cd26
Suppress shift UB in gd_itofx()
...
There doesn't seem to be a corresponding upstream fix for this.
2019-06-19 17:27:09 +02:00
Nikita Popov
88b603768f
imageloadfont: Perform overflow check before calculation
...
Instead of afterwards...
2019-06-19 15:50:52 +02:00
Nikita Popov
2a9fc31021
Fix buffer underflow in gd_gif_in.c
...
This has been fixed upstream in
939d49a3a9 .
2019-06-19 15:41:45 +02:00
Nikita Popov
ea97fc9c1f
Fix shift UB in gd_io.c
...
This has already been fixed upstream in
24d352576c
and
772d0107a6 .
2019-06-19 15:09:00 +02:00
Christoph M. Becker
3c5bb06536
Add BMP support to PHP info
2019-06-13 13:07:01 +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
Nikita Popov
e5411e17c7
Remove unused _setEdgePixel() and getPixelOverflowColorTC() functions
2019-06-11 16:59:12 +02:00
Nikita Popov
5c844c1d36
Fix fabs warning in gd_interpolation.c
...
Matches upstream code.
2019-06-11 16:57:24 +02:00
Nikita Popov
2290102172
Remove safeboolean use in gd_jpeg.c
...
This is a backport of
e5502c7a3f/src/gd_jpeg.c .
2019-06-11 16:54:45 +02:00