Commit graph

415 commits

Author SHA1 Message Date
Sean Fraser
7a7e0f7da0
added test for imagecopymergegray(), added color check to test for imagecopymerge() 2017-06-01 08:17:36 +01:00
Nikita Popov
b2a4af7b58 Merge branch 'PHP-7.1' 2017-02-02 18:15:11 +01:00
Nikita Popov
2d1955796e Merge branch 'PHP-7.0' into PHP-7.1 2017-02-02 18:14:50 +01:00
Matěj Humpál
acda2563ce Fix bug #74031
Fix incorrect parameter count for imagepng function
2017-02-02 18:13:53 +01:00
Christoph M. Becker
5d0048cd75 Merge branch 'PHP-7.1'
* PHP-7.1:
  Add regression test for bug #47946
2017-01-22 15:15:43 +01:00
Christoph M. Becker
4af464a0df Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Add regression test for bug #47946
2017-01-22 15:02:59 +01:00
Christoph M. Becker
71efe9d8fd Add regression test for bug #47946
This bug had already been fixed, but apparently there's no regression
test yet, so we add one.

Note that the expected image has black pixel artifacts, which are
another issue (perhaps bug #40158), and would have to be adressed
separately.
2017-01-22 15:01:01 +01:00
Christoph M. Becker
ee06ca8271 Merge branch 'PHP-7.1'
* PHP-7.1:
  Fix #73968: Premature failing of XBM reading
2017-01-21 13:20:47 +01:00
Christoph M. Becker
7a2497b2c5 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix #73968: Premature failing of XBM reading
2017-01-21 13:18:54 +01:00
Christoph M. Becker
f67d599a01 Fix #73968: Premature failing of XBM reading
We must take into account the line padding, when we're reading XBM
files.

We deliberately ignore the potential integer overflow here, because
that would be caught by gdImageCreate() or even earlier if `bytes==0`,
what happens in libgd00094.phpt which we adapt accordingly.
2017-01-21 13:04:36 +01:00
Anatol Belski
23db1ce3ba Merge branch 'PHP-7.1'
* PHP-7.1:
  Fix #73869: Signed Integer Overflow gd_io.c
  Fix #73868: DOS vulnerability in gdImageCreateFromGd2Ctx()
2017-01-17 09:36:42 +01:00
Anatol Belski
cea050b8da Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix #73869: Signed Integer Overflow gd_io.c
  Fix #73868: DOS vulnerability in gdImageCreateFromGd2Ctx()
2017-01-17 09:35:26 +01:00
Anatol Belski
5d07438cb3 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fix #73869: Signed Integer Overflow gd_io.c
  Fix #73868: DOS vulnerability in gdImageCreateFromGd2Ctx()
2017-01-17 09:33:51 +01:00
Christoph M. Becker
d2274b01cb Fix #73869: Signed Integer Overflow gd_io.c
GD2 stores the number of horizontal and vertical chunks as words (i.e. 2
byte unsigned). These values are multiplied and assigned to an int when
reading the image, what can cause integer overflows. We have to avoid
that, and also make sure that either chunk count is actually greater
than zero. If illegal chunk counts are detected, we bail out from
reading the image.

(cherry picked from commit 5b5d9db3988b829e0b121b74bb3947f01c2796a1)
2017-01-17 09:30:58 +01:00
Christoph M. Becker
f1b2afc9d9 Fix #73868: DOS vulnerability in gdImageCreateFromGd2Ctx()
We must not pretend that there are image data if there are none. Instead
we fail reading the image file gracefully.

(cherry picked from commit cdb648dc4115ce0722f3cc75e6a65115fc0e56ab)
2017-01-17 09:30:43 +01:00
Christoph M. Becker
500b496f8e Implement #69606: Support BMPs (added in GD 2.1.0)
We add PHP bindings for libgd's features to read and write BMP 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.
2017-01-04 14:55:02 +01:00
Stanislav Malyshev
76c02dcdf7 Merge branch 'PHP-7.1'
* PHP-7.1:
  Fix #73549: Use after free when stream is passed to imagepng
2016-11-27 14:54:19 -08:00
Stanislav Malyshev
8cc42537d2 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix #73549: Use after free when stream is passed to imagepng
2016-11-27 14:53:39 -08:00
Stanislav Malyshev
1cb58ead70 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fix #73549: Use after free when stream is passed to imagepng
2016-11-27 14:53:27 -08:00
Christoph M. Becker
5049ef2f1c Fix #73549: Use after free when stream is passed to imagepng
If a stream is passed to imagepng() or other image output functions,
opposed to a filename, we must not close this stream.
2016-11-27 14:51:02 -08:00
Christoph M. Becker
a35359f8b7 Merge branch 'PHP-7.1' 2016-11-25 23:33:02 +01:00
Christoph M. Becker
51ba53ed0f Merge branch 'PHP-7.0' into PHP-7.1 2016-11-25 23:27:13 +01:00
Christoph M. Becker
bc979aee6d Merge branch 'PHP-5.6' into PHP-7.0 2016-11-25 23:16:18 +01:00
Christoph M. Becker
7f529e3dee Fix #73582: Failing ext/gd/tests/imagettftext_charmap_order.phpt
This test is not supposed to work with JIS-mapped Japanese font support
enabled.
2016-11-25 23:14:08 +01:00
Nikita Popov
5af586bec5 Remove more PHP 6 leftovers from tests 2016-11-24 22:39:39 +01:00
Nikita Popov
45f7b2bcc8 Fix CRLF line-endings in tests
Also fix a single instance of CRLF in ibase_query.c.
2016-11-20 22:31:24 +01:00
Christoph M. Becker
189bbb586c Merge branch 'pull-request/2164' 2016-11-13 23:31:40 +01:00
Anatol Belski
a75827b4f9 Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed bug #73418 Integer Overflow in "_php_imap_mail" leads to crash
  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 #72696: imagefilltoborder stackoverflow on truecolor images
  Fix #72482: Ilegal write/read access caused by gdImageAALine overflow
  fix version
  set versions
  Fix bug #73144 and bug #73341 - remove extra dtor
  Fix bug #73331 - do not try to serialize/unserialize objects wddx can not handle
2016-11-08 11:16:55 +01:00
Anatol Belski
9b81342352 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #73418 Integer Overflow in "_php_imap_mail" leads to crash
  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 #72696: imagefilltoborder stackoverflow on truecolor images
  Fix #72482: Ilegal write/read access caused by gdImageAALine overflow
  fix version
  set versions
  Fix bug #73144 and bug #73341 - remove extra dtor
  Fix bug #73331 - do not try to serialize/unserialize objects wddx can not handle
2016-11-08 11:15:06 +01:00
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
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