1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 18:53:33 +02:00

850 Commits

Author SHA1 Message Date
Ben Ramsey 8964e3f58f license-update: ext/gd source headers
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00
David Carlier 277a016723 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/gd: phpinfo() to be able to display libjpeg 10.0 support.
2026-03-14 18:24:17 +00:00
David Carlier e257c086bb ext/gd: phpinfo() to be able to display libjpeg 10.0 support.
Fix #21431

Co-Authored-By: rainerjung

close GH-21432
2026-03-14 18:23:35 +00:00
David Carlier 033dd8a8b7 Merge branch 'PHP-8.4' into PHP-8.5 2025-09-29 23:21:08 +01:00
David Carlier 1015de30f0 Merge branch 'PHP-8.3' into PHP-8.4 2025-09-29 23:20:38 +01:00
David Carlier e029f8f45b Fix GH-19955: imagefttext() memory leak
close GH-19968
2025-09-29 23:20:27 +01:00
Demon 974526b244 ext/gd: Drop useless and doubtful MSVC specific code (libgd/libgd@f1480ab) 2025-07-10 22:22:01 +02:00
Demon 12fa8c637f ext/gd: Drop useless and doubtful MSVC specific code (libgd/libgd@f1480ab) 2025-07-10 22:13:29 +02:00
Demon 2be3aa86f0 Zend: fix undefined symbol 'execute_ex' on Windows ARM64 #19064; ext/gd: fix emmintrin.h not found on Windows ARM64 2025-07-10 22:13:29 +02:00
David CARLIER 18df1e4783 ext/gd create gd object with zend_object_alloc (#17823)
while at it, fix build warning "wrong" calloc arguments order
2025-02-16 00:05:37 +00:00
David Carlier 77d748617a Merge branch 'PHP-8.4' 2025-02-14 15:29:32 +00:00
David Carlier ed18fd073a Merge branch 'PHP-8.3' into PHP-8.4 2025-02-14 15:28:48 +00:00
David Carlier 4d7d01d18e Fix GH-17772: imagepalettetotruecolor segfault on invalid truecolor pixel.
close GH-17777
2025-02-14 15:28:33 +00:00
Christoph M. Becker efcdcd7bde Drop NetWare support from bundled libgd (GH-17596)
This has been removed from upstream years ago[1], and PHP generally
dropped NetWare support even earlier.

[1] <https://github.com/libgd/libgd/commit/e6bb110663722836ba1e6986b27252bc4402a33c>
[2] <https://externals.io/message/96838>
2025-01-27 20:00:34 +01:00
Christoph M. Becker aa76127d01 Address more Clang warnings (GH-17506)
We prefer clean solutions (such as declaring the proper type in the
first place, or introducing a portable format specifier) where easily
possible, but resort to casts otherwise.

We also port https://github.com/libgd/libgd/commit/f1480ab14bd5e2e4b4d83d8f3e64e786aa810637.
2025-01-21 20:05:29 +01:00
Christoph M. Becker 0f40e62ca7 Fix bug 68629: Transparent artifacts when using imagerotate
We port the respective upstream fix[1], which dropped the special cased
implementations of fixed-point arithmetic rotation in favor of the
generic implementation.

We also port follow-up upstream fixes[2][3].

[1] <https://github.com/libgd/libgd/commit/bd6d2e101f6f1df106d1cd2e2dc8058a5538109b>
[2] <https://github.com/libgd/libgd/commit/6d21d304295731d67db324dc3bf4630a69ebc5d6>
[3] <https://github.com/libgd/libgd/commit/9df878a4006130f3b5c8ee6e1f5ce9e8e6c9db07>

Closes GH-17375.
2025-01-09 13:19:25 +01:00
Christoph M. Becker 757faee9ec Merge branch 'PHP-8.4'
* PHP-8.4:
  Add support for reading GIFs without colormap
2025-01-09 12:07:03 +01:00
Christoph M. Becker 38365a44d0 Add support for reading GIFs without colormap
Cf. <https://github.com/libgd/libgd/commit/fc38677e8005c24db891b84d3e84df7a199c979c>.

Closes GH-17364.
2025-01-09 12:06:24 +01:00
Christoph M. Becker 2c49f52b0d Port "improve _gdImageFillTiled() internal function" (GH-17356)
This improvement was done for libgd 2.1.0[1], and the erroneous
calculation has been fixed as of libgd 2.2.0[2].

While we're at it we also add the overflow checks of external libgd;
these are not really necessary, since `.sx * .sy` overflow was already
prevented when the image has been created, and since we're using
`safe_emalloc()` the `struct seg` overflow is also prevented.  It
should be noted that `overflow2()` prevents `int` overflow, while
`safe_emalloc()` prevents `size_t` overflow, so the former is more
restrictive.  For parity with external libgd, this still appears to be
a good thing.

[1] <https://github.com/libgd/libgd/commit/86a5debede97ded92d644c3e06964c299e1e0810>
[2] <https://github.com/libgd/libgd/commit/e87ec88e1c4db664baf2c42e7fccf3f9dc53f0a6>
2025-01-07 01:23:05 +01:00
Christoph M. Becker e4df0cbe1c Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix libgd 223: gdImageRotateGeneric() does not properly interpolate
2025-01-06 20:39:14 +01:00
Christoph M. Becker 12e4ee492b Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix libgd 223: gdImageRotateGeneric() does not properly interpolate
2025-01-06 20:38:34 +01:00
Christoph M. Becker 47683487f8 Fix libgd 223: gdImageRotateGeneric() does not properly interpolate
We port the respective upstream fix[1].  We only run the test against
bundled libgd, since external libgd may yield different results.

Cf. <https://github.com/libgd/libgd/commit/2b26be874d0c0987c4906a40ef8f0e8fee04ae8f>.

Closes GH-17380.
2025-01-06 20:37:23 +01:00
Christoph M. Becker f5aa69a5fc Port "merged and expanded settings from gd.h and gdft.c" (GH-17367)
This commit[1] and the related part of the Netware removal[2] move the
related definitions out of gd.h, and bring some updates.

[1] <https://github.com/libgd/libgd/commit/2a921c80fbdd1d684f32bf763c26e024052314e6>
[2] <https://github.com/libgd/libgd/commit/e6bb110663722836ba1e6986b27252bc4402a33c>
2025-01-06 15:01:50 +01:00
Christoph M. Becker cc84d271ea Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17373: imagefttext() ignores clipping rect for palette images
2025-01-06 14:59:38 +01:00
Christoph M. Becker 61dcfc4c9a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17373: imagefttext() ignores clipping rect for palette images
2025-01-06 14:59:03 +01:00
Christoph M. Becker ec90367cd8 Fix GH-17373: imagefttext() ignores clipping rect for palette images
We apply the same fix that has been applied to external libgd at least
as of 2.0.29.

To avoid issues regarding minor FreeType rendering differences, the
test case does not compare against an image, but rather checks that all
pixels outside the clipping rect have the background color.

Closes GH-17374.
2025-01-06 14:57:46 +01:00
Christoph M. Becker a3ef48c265 Port "move pixelate filter to gd_filter.c" (sync with upstream) (GH-17361)
Cf. <https://github.com/libgd/libgd/commit/0f0894a7dd5c74cb9824f5c297569434c0f5b12e>.
2025-01-05 11:24:24 +01:00
Christoph M. Becker 5ba2143c1c Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-17349: Tiled truecolor filling looses single color transparency
2025-01-04 14:54:27 +01:00
Christoph M. Becker 5a01c3293a Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17349: Tiled truecolor filling looses single color transparency
2025-01-04 14:54:11 +01:00
Christoph M. Becker 2c658f422d Fix GH-17349: Tiled truecolor filling looses single color transparency
This is porting the relevant part of a previous upstream commit[1] to
align the behavior of our bundled libgd with upstream.  It should be
noted that this only works if the image actually has a transparent
color.

[1] <https://github.com/libgd/libgd/commit/4770e2b2d50c71e60cb073f6bc2e9bc82ec978f7>

Closes GH-17351.
2025-01-04 14:53:18 +01:00
Christoph M. Becker 2490097420 Port insertion sort improvement of libgd 2.0.26 (GH-17342)
Possibly a minor performance improvement, but at least in sync with
upstream this way.
2025-01-04 13:13:06 +01:00
Christoph M. Becker 8a0b617940 Port clip_1d() clipping rectangle improvement of libgd 2.0.26 (GH-17341)
This is not a functional change, but rather a performance improvement,
to avoid unnecessary calls of `gdImageSetPixel()` which would be no-ops
due to positions outside of the clipping bounds.
2025-01-03 18:26:46 +01:00
Christoph M. Becker f55d6cc110 Internalize gdImageScale*() and gdImageRotate*() helpers
This is basically a port of the "Small code cleanup" commit[1].

We can now drop the superfluous checks for zero width/height.  These
have been introduced as fix for bug 72337[2], while the same issue had
a simpler fix for upstream[3], because the helper functions already
were internal.

[1] <https://github.com/libgd/libgd/commit/e054be7d82df34aefa099ed92065e510ce7f3b6b>
[2] <https://bugs.php.net/72337>
[3] <https://github.com/libgd/libgd/commit/77309c419cda4b9a4c5f5b2c61df9af8427c0741>
2025-01-03 14:26:36 +01:00
Christoph M. Becker 11d701a6ab Port fix for libgd bug 447 (GH-17320)
That bug has been potentially exploitable[1], but the GD extension was
not affected by that, because `gdImageBmpPtr()` is never called.  Still
it seems to be reasonable to port the fix; if only to keep bundled and
external libgd synced.

[1] <https://github.com/advisories/GHSA-hc3p-jvff-jfw5>
2025-01-03 12:57:12 +01:00
Christoph M. Becker 12ecdad183 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Port fix for libgd bug 276
2024-12-25 16:29:06 +01:00
Christoph M. Becker 643a77dda3 Port fix for libgd bug 276
The issue that BMP RLE occasionally swallowed some pixels[1] had been
fixed long ago in libgd, but apparently it has been overlooked to port
it to our bundled libgd.

We also introduce the test helper `test_image_equals_image()` which
compares in-memory images for equality.

[1] <https://github.com/libgd/libgd/issues/276>

Closes GH-17250.
2024-12-25 16:27:20 +01:00
Niels Dossche d7e7e2b338 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16559: UBSan abort in ext/gd/libgd/gd_interpolation.c:1007
2024-10-23 20:10:04 +02:00
Niels Dossche 6d6afd9a83 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16559: UBSan abort in ext/gd/libgd/gd_interpolation.c:1007
2024-10-23 20:09:39 +02:00
Niels Dossche e1e1e64a32 Fix GH-16559: UBSan abort in ext/gd/libgd/gd_interpolation.c:1007
The `uchar_clamp` function was backported from old code, this backports
it from new code.

Closes GH-16562.
2024-10-23 20:09:12 +02:00
Christoph M. Becker 055b15f08c Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16427: Unchecked libavif return values
2024-10-14 13:54:52 +02:00
Christoph M. Becker 05176adc4e Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16427: Unchecked libavif return values
2024-10-14 13:53:42 +02:00
Christoph M. Becker b817a4f718 Fix GH-16427: Unchecked libavif return values
Prior to libavif 1.1.0, `avifAlloc()` was infallible (it called
`abort()` on OOM conditions); thus, several API functions which used
`avifAlloc()` did not report failure.  That changed as of libavif
1.0.0[1], so checking and handling failure conditions can now be done.
However, due to `avifAlloc()` being fallible as of libavif 1.1.0, this
error checking and handling is mandatory to avoid more serious issues.

[1] <https://github.com/AOMediaCodec/libavif/blob/eb02b2ec52df5c0f50b71fbc51321c5ce435aaca/CHANGELOG.md?plain=1#L273-L281>

Closes GH-16434.
2024-10-14 13:52:45 +02:00
David Carlier 7f1fd0646b Merge branch 'PHP-8.3' into PHP-8.4 2024-10-07 13:05:41 +01:00
David Carlier 7c43f68c98 Merge branch 'PHP-8.2' into PHP-8.3 2024-10-07 13:05:32 +01:00
David Carlier a2bdfeff4f Fix GH-16257 imagescale underflow on RGB channels.
backport of https://github.com/libgd/libgd/commit/948bb0a5c2010a24227e4b44a90e8b8aa9bda8ce

close GH-16257
2024-10-07 13:05:05 +01:00
David Carlier 215c61f9c7 Merge branch 'PHP-8.3' into PHP-8.4 2024-10-05 11:34:59 +01:00
David Carlier 8ff179529a Merge branch 'PHP-8.2' into PHP-8.3 2024-10-05 11:34:49 +01:00
David Carlier 54973c9366 Fix GH-16232: bitshift overflow on wbmp file content reading.
backport from https://github.com/libgd/libgd/commit/a8f1d5cab0cad2bca2ed88a49c3f3de8585ff19b

close GH-16239
2024-10-05 11:34:31 +01:00
Christoph M. Becker f89eb15f72 Port libgd/libgd/pull/711 (GH-16016)
Note that this is not actually security related[1], but still a
reasonable sanity check.

"If a function be advertised to return an error code in the event of
difficulties, thou shalt check for that code, yea, even though the
checks triple the size of thy code and produce aches in thy typing
fingers, for if thou thinkest it cannot happen to me, the gods shall
surely punish thee for thy arrogance." – Henry Spencer

[1] <https://github.com/libgd/libgd/issues/697#issuecomment-2369613187>
2024-09-24 13:58:31 +02:00
David Carlier 307565d577 ext/gd: porting gdImageClone to the bundled libgd version.
close GH-15640
2024-08-29 23:13:20 +01:00