Commit graph

1761 commits

Author SHA1 Message Date
Anatol Belski
2b30b54275 Merge remote-tracking branch 'phpsec/PHP-7.0.13' into PHP-7.0
* phpsec/PHP-7.0.13:
  Fixed bug #73418 Integer Overflow in "_php_imap_mail" leads to crash
  Fix #72696: imagefilltoborder stackoverflow on truecolor images
  Fix #72482: Ilegal write/read access caused by gdImageAALine overflow
  Fix bug #73144 and bug #73341 - remove extra dtor
  remove unreferenced var came in with merge
  Fix bug #73331 - do not try to serialize/unserialize objects wddx can not handle
  fix version
  set versions
2016-11-08 11:13:29 +01:00
Anatol Belski
33766347cb Merge remote-tracking branch 'phpsec/PHP-5.6.28' into PHP-5.6 2016-11-08 11:06:52 +01:00
Christoph M. Becker
5693474997 Fix #72696: imagefilltoborder stackoverflow on truecolor images
We must not allow negative color values be passed to
gdImageFillToBorder(), because that can lead to infinite recursion
since the recursion termination condition will not necessarily be met.

(cherry picked from commit 863d37ea66)
2016-11-01 13:07:37 +01:00
Christoph M. Becker
1b5543b8ab Fix #72482: Ilegal write/read access caused by gdImageAALine overflow
Instead of rolling our own bounds check we use clip_1d() as it's done
in gdImageLine() and in external libgd. We must not pass the image
width and height, respectively, but rather the largest ordinate value
that is allowed to be accessed, i.e. width-1 and height-1,
respectively.

(cherry picked from commit 6499581af7)
2016-11-01 13:03:41 +01:00
Christoph M. Becker
863d37ea66 Fix #72696: imagefilltoborder stackoverflow on truecolor images
We must not allow negative color values be passed to
gdImageFillToBorder(), because that can lead to infinite recursion
since the recursion termination condition will not necessarily be met.
2016-10-30 14:31:29 -07:00
Christoph M. Becker
6499581af7 Fix #72482: Ilegal write/read access caused by gdImageAALine overflow
Instead of rolling our own bounds check we use clip_1d() as it's done
in gdImageLine() and in external libgd. We must not pass the image
width and height, respectively, but rather the largest ordinate value
that is allowed to be accessed, i.e. width-1 and height-1,
respectively.
2016-10-30 14:28:23 -07:00
Christoph M. Becker
c8c8c0b52c Merge branch 'PHP-7.1' 2016-10-25 14:41:00 +02:00
Christoph M. Becker
c30e5a32c1 Merge branch 'PHP-7.0' into PHP-7.1 2016-10-25 14:35:38 +02:00
Christoph M. Becker
af4bfe234c Merge branch 'PHP-5.6' into PHP-7.0 2016-10-25 14:31:41 +02:00
Christoph M. Becker
cd13d0260a Fix #72494: imagecropauto out-of-bounds access
This issue has actually already been fixed with commit 46f2c690. We're
adding a regression test and a NEWS entry, and also port the fix in
gdImageCropThreshold() from libgd:
  * <b347e034>
  * <46f2c690>
2016-10-25 14:29:48 +02:00
Joe Watkins
e0b6ac2976 Merge branch 'pull-request/2135' 2016-10-20 05:33:12 +01:00
Christoph M. Becker
371f41250c Remove superfluous checks for PNG support
PNG support is required to build ext/gd, so there's no need to check
for it in the tests.
2016-10-18 14:17:37 +02:00
Christoph M. Becker
209d4220d5 Add PHP bindings for setting and getting the image resolution
We expose the image resolution related GD functionality to userland
by introducing `imageresolution()` as getter/setter. Given only the
image argument, it returns the current resolution as indexed array.
Given only a second argument, it sets the horizontal and vertical
resolution to this value. Given three arguments, it sets the horizontal
and vertical resolution to the given arguments, respectively.
2016-10-18 01:53:39 +02:00
Christoph M. Becker
0f49aa3287 Merge branch 'pull-request/2151' 2016-10-17 10:37:38 +02:00
Christoph M. Becker
1aaa560d85 Mark functions as PHP_DEP_FE instead of manually emitting the notice 2016-10-15 23:41:33 +02:00
Christoph M. Becker
1490446ce0 RFC: Deprecate png2wbmp() and jpegwbmp()
See <https://wiki.php.net/rfc/deprecate-png-jpeg-2wbmp>.
2016-10-15 16:16:34 +02:00
Christoph M. Becker
0864915550 Fix #73280: Stack Buffer Overflow in GD dynamicGetbuf
We make sure to never pass a negative `rlen` as size to memcpy().

Cf. <53110871>.

(cherry picked from commit cc08cbc84d)
2016-10-14 02:02:42 +02:00
Christoph M. Becker
c31eb5a407 Remove unused code
There is no gif2wbmp() or such, and it is highly unlikely that it'll be
ever added, so we remove the unused code.
2016-10-13 15:35:10 +02:00
Anatol Belski
19605950fc add missing header for gd_error 2016-10-13 14:40:37 +02:00
Anatol Belski
fa45124138 fix syslog interference 2016-10-13 14:40:37 +02:00
Christoph M. Becker
a9209588d5 Merge branch 'PHP-7.0' into PHP-7.1 2016-10-13 11:31:37 +02:00
Christoph M. Becker
b8fab503fe Merge branch 'PHP-5.6' into PHP-7.0 2016-10-13 11:25:11 +02:00
Christoph M. Becker
cc08cbc84d Fix #73280: Stack Buffer Overflow in GD dynamicGetbuf
We make sure to never pass a negative `rlen` as size to memcpy().

Cf. <53110871>.
2016-10-13 11:10:02 +02:00
Christoph M. Becker
4be36b536e Merge branch 'PHP-7.1' 2016-10-10 12:13:07 +02:00
Christoph M. Becker
0f40ca989a Merge branch 'PHP-7.0' into PHP-7.1 2016-10-10 12:12:13 +02:00
Christoph M. Becker
fb08216b08 Merge branch 'PHP-5.6' into PHP-7.0 2016-10-10 11:45:53 +02:00
Christoph M. Becker
fc989fc6e7 Fix #73279: Integer overflow in gdImageScaleBilinearPalette()
The color components are supposed to be in range 0..255, so we must not
cast them to `signed char`, what can be the default for `char`.

Port of <77c8d359>.
2016-10-10 11:41:39 +02:00
Christoph M. Becker
7ce90014e2 Merge branch 'PHP-7.1' 2016-10-09 15:27:14 +02:00
Christoph M. Becker
a16f0c5e01 Merge branch 'PHP-7.0' into PHP-7.1 2016-10-09 15:21:40 +02:00
Christoph M. Becker
c930714cbe Merge branch 'PHP-5.6' into PHP-7.0 2016-10-09 15:14:17 +02:00
Christoph M. Becker
b92216b97d Fix #73272: imagescale() affects imagesetinterpolation()
We must not permanently change the interpolation method, but rather
have to restore the old method after we're done with scaling the image.
2016-10-09 15:10:34 +02:00
Christoph M. Becker
432e16cb58 Unify error handling of bundled and external libgd
There's no need anymore to call an own error handler directly. Instead we
register our error handler and call libgd's error functions (which will
forward). We do this regardless of compiling with the bundled or an external
libgd.
2016-10-07 01:13:49 +02:00
Christoph M. Becker
2b134a1dcb Move freeing of truecolor pixels to a function
We port <81675d39>.
2016-10-03 12:11:46 +02:00
Christoph M. Becker
ec591b555f Change gdImageTrueColorToPalette() to return success/failure
We're porting the relevant changes from
<34a00a40>.

We also check the return value in the PHP binding, and throw E_WARNING if
the conversion failed.
2016-10-03 12:02:31 +02:00
Christoph M. Becker
2a305b38b7 Implement request #33066: Add GD Image Function gdImageOpenPolygon()
gdImageOpenPolygon() has been introduced with líbgd 2.0.29, so we finally
add a PHP binding for it, and port the respective libgd functionality to
PHP's bundled libgd.
2016-10-02 20:27:58 +02:00
Christoph M. Becker
82a8e57f37 Add support for gdEffectMultiply
gdLayerMultiply() has been introduced in libgd 2.1.1, and as such would have
been already available for imagelayereffect() with a system libgd. We port
the respective code to the bundled libgd, and also make IMG_EFFECT_MULTIPLY
available to userland.
2016-10-02 19:10:13 +02:00
Christoph M. Becker
d0f14a4429 Switch to libgd anti-aliased drawing API
Instead of rolling our own in the bundled libgd, we use libgd's anti-aliased
drawing API. This way imageantialias() is also available, when built against
a system libgd.
2016-10-02 13:16:40 +02:00
Christoph M. Becker
0e38932d14 Merge branch 'PHP-7.1' 2016-10-01 00:02:05 +02:00
Christoph M. Becker
f6da70863f Merge branch 'PHP-7.0' into PHP-7.1 2016-10-01 00:00:46 +02:00
Christoph M. Becker
12967bc346 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-30 23:54:18 +02:00
Christoph M. Becker
9acfb1a3a5 Fix #73213: Integer overflow in imageline() with antialiasing
We port the respective fixes <eca37d620>
and <837b7327> to our bundled libgd.
2016-09-30 23:38:13 +02:00
Christoph M. Becker
c60cdac636 Fix overflow checks
We check for the proper sizeofs, cf.
<c3cf674c>.
2016-09-30 20:15:15 +02:00
Christoph M. Becker
e3b889700b Remove further remains of the old antialiasing support
Curiously, while the external GD claims "just a few vestiges after switching
to the fast, memory-cheap implementation from PHP-gd", that stuff was still
in the bundled GD.
2016-09-30 17:04:37 +02:00
Christoph M. Becker
04400b19fc Remove basically effectless gdImageAABlend()
This had already be done for GD 2.0.26 as part of the improved antialiasing
support (<https://boutell.com/gd/manual2.0.26.html#whatsnew2.0.26>).
2016-09-30 16:12:47 +02:00
Anatol Belski
56ff613974 Merge branch 'PHP-7.1'
* PHP-7.1:
  Add an include path for freetype which is relevant for cmake builds
2016-09-25 20:58:09 +02:00
Anatol Belski
2b8024bb04 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Add an include path for freetype which is relevant for cmake builds
2016-09-25 20:57:30 +02:00
Anatol Belski
4e7b5ca459 Add an include path for freetype which is relevant for cmake builds 2016-09-25 20:55:13 +02:00
Christoph M. Becker
65ee87f20d Refactor imagegammacorrect()
We apply the law `(b**r)**s == b**(r*s)` which holds for all non-negative b
and positive r,s, so a single pow() suffices. Furthermore, we precompute the
gamma, so the refactored code is simpler and faster.
2016-09-25 11:28:39 +02:00
Christoph M. Becker
47f1666f7c Merge branch 'PHP-7.1' 2016-09-25 10:57:23 +02:00
Christoph M. Becker
daba342f57 Merge branch 'PHP-7.0' into PHP-7.1 2016-09-25 10:49:43 +02:00