Commit graph

723 commits

Author SHA1 Message Date
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
Peter Kokot
812dbed0e9 [ci skip] Refactor libgd docs
Changes to simplify managing libgd docs a bit:
- Move copyright statement and licensing info to common redistributable
  bins file. All previous notices left intact and updated with the
  upstream info.
- Remove unsynced and difficult to track README file compared to
  upstream README.md file available at https://github.com/libgd/libgd
2019-05-12 23:51:39 +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
Nikita Popov
7207110362 Fix uninit warning in gd.c
This matches the upstream implementation.
2019-04-12 16:03:01 +02:00
Nikita Popov
9d663cba1a Fix libgd warnings 2019-04-11 15:54:09 +02:00
Fabien Villepinte
b6f9ade9f2 Remove unused variables 2019-03-17 23:29:51 +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
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Christoph M. Becker
089f7c0bc2 Sync with upstream
Even though libgd/libgd#492 is not a relevant bug fix for PHP, since
the binding doesn't use the `gdImage*Ptr()` functions at all, we're
porting the fix to stay in sync here.
2019-01-19 11:30:12 +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
Nikita Popov
19d8a6b771 Migrate ext/gd to pkg-config
* --with-webp-dir becomes --with-webp
* --with-jpeg-dir becomes --with-jpeg
* --with-png-dir is removed. libpng is required.
* --with-zlib-dir is removed. zlib is required.
* --with-xpm-dir becomes --with-xpm.

We also enable --with-webp on Travis.
2019-01-15 10:15:05 +01:00
Christoph M. Becker
8c21ce5b2e Fix misleading variable type
We port libgd/libgd@0414bb2da0.
2019-01-11 00:21:44 +01:00
Christoph M. Becker
41c3e3d853 Remove unused variables and functions
We remove the unused variables altogether, and port
libgd/libgd@f50c24e467 to silence the
compiler warnings.
2019-01-10 18:00:27 +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
Christoph M. Becker
3f9ddeb122 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #73281: imagescale(…, IMG_BILINEAR_FIXED) can cause black border
2019-01-10 16:27:43 +01:00
Christoph M. Becker
6b4cdbaade Fix #73281: imagescale(…, IMG_BILINEAR_FIXED) can cause black border
We port the upstream fixes for libgd/libgd#329 and libgd/libgd#224.
2019-01-10 16:11:23 +01:00
Christoph M. Becker
50ba0149d9 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #77272: imagescale() may return image resource on failure
2019-01-10 14:25:53 +01:00