Commit graph

747 commits

Author SHA1 Message Date
Christoph M. Becker
ecf4e7063d Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix potential integer overflow detected by oss-fuzz
2020-08-24 17:38:50 +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
Nikita Popov
ca48129cae Return void from php_jpeg_emit_message()
Instead of returning long and then casting to void.

This fixes a build warning on Ubuntu 20.04.

Closes GH-5742.
2020-06-19 16:59:29 +02:00
Christoph M. Becker
b7a55aaff2 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79676: imagescale adds black border with IMG_BICUBIC
2020-06-12 14:09:16 +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
7f51f43509 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79615: Wrong GIF header written in GD GIFEncode
2020-05-22 09:22:38 +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
George Peter Banyard
2f0dcf2ac2 Fix [-Wundef] warning in GD extension 2020-05-20 18:22:09 +02:00
Máté Kocsis
1f48feebb9
Improve some TypeError and ValueError messages
Closes GH-5377
2020-04-14 14:38:45 +02:00
George Peter Banyard
ac89139773 Fix [-Wtype-limits] in bundled GD lib by using signed integers
As seen in the gdImageRotateBicubicFixed() function the same setup
occurs but it uses signed integers, therefore we use also use
signed integers in gdImageRotateBilinear()

Moreover, these two functions have been removed upstream in
bd6d2e101f
therefore we should also mimic upstream and remove them...

Thanks to @cmb69 for pointing it out.
2020-02-06 01:34:09 +01:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Máté Kocsis
afdaa91170
Fix #78880: Final spelling fixes 2020-01-16 19:14:31 +01:00
Christoph M. Becker
03bd4333f6 Add imagegetinterpolation()
While `imagesetinterpolation()` is available as of PHP 5.5.0,
there is no according getter function, so users would have to track the
current interpolation method manually.

To remedy this, we introduce `imagegetinterpolation()` as thin wrapper
for `gdImageGetInterpolationMethod()` (which has been introduced with
libgd 2.1.1), and use `im->interpolation_id` as fallback for older
libgd.  Since our bundled libgd does not yet have this function, we add
it.

We also simplify the recently introduced bug79068.phpt, where it is
sufficient to check that the interpolation method has not been changed.
2020-01-14 18:25:27 +01:00
Christoph M. Becker
5836c7063b Avoid superfluous assignments
These values are already set via the initializers.
2020-01-09 00:17:14 +01:00
Christoph M. Becker
be0b94c220 Fix hypothetical segfault in gdTransformAffineCopy()
This has been reported to upstream[1], but since ext/gd never calls
`gdTransformAffineCopy()` for a palette image, it is not a bug for PHP.
Therefore we apply the fix to master only.

[1] <https://github.com/libgd/libgd/issues/586>
2020-01-06 13:25:11 +01:00
Christoph M. Becker
5c51a482c9 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79068: gdTransformAffineCopy() changes interpolation method
2020-01-06 10:39:00 +01: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
bc04d5e9fc Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79067: gdTransformAffineCopy() may use unitialized values
2020-01-06 09:38:19 +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
2ede8db1b4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78923: Artifacts when convoluting image with transparency
2019-12-07 12:09:16 +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
b40799efcd Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78849: GD build broken with -D SIGNED_COMPARE_SLOW
2019-11-21 10:04:03 +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
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +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
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
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
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
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
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
Nikita Popov
0849a621fd Fix abs(long) warnings in gd.c
I'm fixing this using (int) casts instead of labs() because this is
what upstream GD does.
2019-06-11 16:50:25 +02:00
Stanislav Malyshev
892a188fc9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix function name
2019-05-27 17:21:28 -07:00
Stanislav Malyshev
e63b2ba310 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix function name
2019-05-27 17:21:23 -07:00
Stanislav Malyshev
9bca9ef6cf Fix function name 2019-05-27 17:20:56 -07: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