Commit Graph

1356 Commits

Author SHA1 Message Date
Pierre Joye
e8b768dd92 Merge branch 'PHP-5.6' of git.php.net:php-src into PHP-5.6 2016-07-20 00:18:56 +07:00
Pierre Joye
9cc0a5a9a9 #72482, revert for 5.6 for now 2016-07-20 00:18:25 +07:00
Christoph M. Becker
828f911efd Fix #43828: broken transparency of imagearc for truecolor in blendingmode
No pixel of a filled arc must ever be drawn multiple times. Otherwise we get
artifacts regarding transparency. That happens with the current
implementation of gdImageFilledArc() unless gdChord or gdNoFill are set.
When gdPie is set, however, the filled arc is drawn in wedges, which are
polygons of three points, and so some overlap is natural.

To resolve the issue, we stick with the current algorithm of calculating the
wedges, but instead of drawing each polygon separately, we put the relevant
points in a large array, and draw a single polygon. That also is supposed to
improve the performance considerably.

Note that this modification will change the results when gdImageSetStyle()
or gdImageSetBrush() are used, but we believe that this modification is also
an improvement in this regard, even though it still might not make much
sense to use these functions with gdImageFilledArc().

The respective fix for libgd is
<https://github.com/libgd/libgd/commit/e7e20d6>.
2016-07-19 17:38:26 +02:00
Pierre Joye
b25009fc2c #72482, Ilegal write/read access caused by gdImageAALine overflow 2016-07-19 19:34:07 +07:00
Pierre Joye
1d69028d2f fix #72494, improve input color check and prevent issues when old gd are used, done before gd call 2016-07-19 18:23:51 +07:00
Pierre Joye
48e76abadd improve fix #72558, free contribRow as well 2016-07-19 16:33:17 +07:00
Pierre Joye
df09515089 improve fix #72558, while (u>=0) with unsigned int will always be true 2016-07-19 15:51:43 +07:00
Stanislav Malyshev
f69362d212 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix memory leak
2016-07-19 01:47:40 -07:00
Stanislav Malyshev
47d6ea6332 Fix memory leak 2016-07-19 01:47:27 -07:00
Stanislav Malyshev
4d0565b5ba Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  fix #72519, possible OOB using imagegif
  fix #72512, invalid read or write for palette image when invalid transparent index is used
  Apparently some envs miss SIZE_MAX
  Fix tests
  Fix bug #72618: NULL Pointer Dereference in exif_process_user_comment
  Partial fix for bug #72613 - do not treat negative returns from bz2 as size_t
  Fix bug #72606: heap-buffer-overflow (write) simplestring_addn simplestring.c
  Fix for bug #72558, Integer overflow error within _gdContributionsAlloc()
  Fix bug #72603: Out of bound read in exif_process_IFD_in_MAKERNOTE
  Fix bug #72562 - destroy var_hash properly
  Fix bug #72533 (locale_accept_from_http out-of-bounds access)
  Fix fir bug #72520
  Fix for bug #72513
  CS fix and comments with bug ID
  Fix for HTTP_PROXY issue.
  add tests for bug #72512
  Fixed bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write/read access
  Fixed bug #72479 - same as #72434

Conflicts:
	ext/bz2/bz2.c
	main/SAPI.c
	main/php_variables.c
2016-07-19 00:53:08 -07:00
Pierre Joye
8dc5ffa479 fix #72519, possible OOB using imagegif 2016-07-19 00:37:53 -07:00
Pierre Joye
928aecc002 fix #72512, invalid read or write for palette image when invalid transparent index is used
Conflicts:
	ext/gd/libgd/gd.c
2016-07-19 00:37:38 -07:00
Pierre Joye
b61bd1243a Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  fix #72519, possible OOB using imagegif
2016-07-19 14:16:01 +07:00
Pierre Joye
2fbce5f51f fix #72519, possible OOB using imagegif 2016-07-19 14:11:44 +07:00
Pierre Joye
511f07b747 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  fix #72512, invalid read or write for palette image when invalid transparent index is used
2016-07-19 13:39:46 +07:00
Pierre Joye
0fbcff1b35 fix #72512, invalid read or write for palette image when invalid transparent index is used 2016-07-19 13:37:23 +07:00
Christoph M. Becker
3c3980caa1 Merge branch 'pull-request/1991' into PHP-5.6 2016-07-19 00:42:49 +02:00
Christoph M. Becker
6cb75fb1e8 Fix #70315: 500 Server Error but page is fully rendered
That happens because the external libgd uses other error codes than PHP
(and the bundled libgd), but the libgd error codes are simply forwarded
to php_verror(). We fix that by properly mapping libgd errors to PHP errors.
2016-07-19 00:18:07 +02:00
Stanislav Malyshev
d1a491acf3 Fix for bug #72558, Integer overflow error within _gdContributionsAlloc() 2016-07-18 00:17:48 -07:00
Christoph M. Becker
3666cfab97 Fix #72604: imagearc() ignores thickness for full arcs
We remove the special casing for full arcs, what conforms to external libgd.
2016-07-15 19:45:52 +02:00
Christoph M. Becker
8bb3bd04a9 Fix bug #72596: imagetypes function won't advertise WEBP support
We add the constant IMG_WEBP and make sure that WebP support is properly
reported by imagetypes().
2016-07-14 17:17:59 +02:00
Anatol Belski
b63d41e1e5 add tests for bug #72512 2016-07-06 10:40:52 +02:00
Pierre Joye
7b2c22696a Fixed bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write/read access 2016-07-04 10:35:20 +02:00
Anatol Belski
fd93c8601d remove the huge test file, generate it on the fly instead 2016-06-21 09:45:26 +02:00
Anatol Belski
0c7250f260 remove the huge test file, generate it on the fly instead 2016-06-21 09:42:38 +02:00
Stanislav Malyshev
c9b24ef307 Merge branch 'PHP-5.6.23' into PHP-5.6
* PHP-5.6.23:
  Fixed bug #72446 - Integer Overflow in gdImagePaletteToTrueColor() resulting in heap overflow
  update NEWS
  fix tests
  fix build
  Fix bug #72455:  Heap Overflow due to integer overflows
  Fix bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize
  Fixed ##72433: Use After Free Vulnerability in PHP's GC algorithm and unserialize
  Fix bug #72407: NULL Pointer Dereference at _gdScaleVert
  Fix bug #72402: _php_mb_regex_ereg_replace_exec - double free
  Fix bug #72298	pass2_no_dither out-of-bounds access
  Fixed #72339 Integer Overflow in _gd2GetHeader() resulting in heap overflow
  Fix bug #72262 - do not overflow int
  Fix bug #72400 and #72403 - prevent signed int overflows for string lengths
  Fix bug #72275: don't allow smart_str to overflow int
  Fix bug #72340: Double Free Courruption in wddx_deserialize
  Fix bug #72321 - use efree() for emalloc allocation
  5.6.23RC1

Conflicts:
	configure.in
	main/php_version.h
2016-06-21 00:02:37 -07:00
Stanislav Malyshev
7dde353ee7 Merge branch 'PHP-5.5' into PHP-5.6.23
* PHP-5.5:
  Fixed bug #72446 - Integer Overflow in gdImagePaletteToTrueColor() resulting in heap overflow
  update NEWS
  fix tests
  fix build
  Fix bug #72455:  Heap Overflow due to integer overflows
  Fix bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize
  Fixed ##72433: Use After Free Vulnerability in PHP's GC algorithm and unserialize
  Fix bug #72407: NULL Pointer Dereference at _gdScaleVert
  Fix bug #72402: _php_mb_regex_ereg_replace_exec - double free
  Fix bug #72298	pass2_no_dither out-of-bounds access
  Fixed #72339 Integer Overflow in _gd2GetHeader() resulting in heap overflow
  Fix bug #72262 - do not overflow int
  Fix bug #72400 and #72403 - prevent signed int overflows for string lengths
  Fix bug #72275: don't allow smart_str to overflow int
  Fix bug #72340: Double Free Courruption in wddx_deserialize
  update NEWS
  Fix #66387: Stack overflow with imagefilltoborder
  Skip test which is 64bits only
  5.5.37 now

Conflicts:
	configure.in
	ext/mcrypt/mcrypt.c
	ext/spl/spl_directory.c
	main/php_version.h
2016-06-21 00:01:48 -07:00
Stanislav Malyshev
c395c6e5d7 iFixed bug #72446 - Integer Overflow in gdImagePaletteToTrueColor() resulting in heap overflow 2016-06-20 23:58:26 -07:00
Stanislav Malyshev
e1d2f86a41 Merge branch 'PHP-5.5.37' into PHP-5.5
* PHP-5.5.37:
  fix tests
  fix build
  Fix bug #72455:  Heap Overflow due to integer overflows
  Fix bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize
  Fixed ##72433: Use After Free Vulnerability in PHP's GC algorithm and unserialize
  Fix bug #72407: NULL Pointer Dereference at _gdScaleVert
  Fix bug #72402: _php_mb_regex_ereg_replace_exec - double free
  Fix bug #72298	pass2_no_dither out-of-bounds access
  Fixed #72339 Integer Overflow in _gd2GetHeader() resulting in heap overflow
  Fix bug #72262 - do not overflow int
  Fix bug #72400 and #72403 - prevent signed int overflows for string lengths
  Fix bug #72275: don't allow smart_str to overflow int
  Fix bug #72340: Double Free Courruption in wddx_deserialize
2016-06-20 23:31:54 -07:00
Stanislav Malyshev
5f107ab8a6 fix tests 2016-06-20 22:54:55 -07:00
Christoph M. Becker
4b4275059f Fix #64641: imagefilledpolygon doesn't draw horizontal line
As has been reported, 1-dimensional horizontal filled polygons are not drawn
at all. That is caused by the scanline algorithm used for drawing filled
polygons which skips the drawing of horizontal edges, because that is
normally not necessary. If, however, the polygon consists of horizontal
edges only, that obviously doesn't work, so we add a special case handling.

That has also been fixed in libgd with
<https://github.com/libgd/libgd/commit/f9f10fa9>.
2016-06-20 15:17:52 +02:00
Stanislav Malyshev
b9ec171e7d Fix bug #72407: NULL Pointer Dereference at _gdScaleVert 2016-06-18 21:57:25 -07:00
Stanislav Malyshev
e9ac8954be Fix bug #72298 pass2_no_dither out-of-bounds access 2016-06-18 21:06:09 -07:00
Pierre Joye
7722455726 Fixed #72339 Integer Overflow in _gd2GetHeader() resulting in heap overflow 2016-06-18 20:15:10 +02:00
Christoph M. Becker
ed0ec66996 Fix #53640: XBM images require width to be multiple of 8 2016-06-17 17:50:36 +02:00
Christoph M. Becker
8aa511f1fc Fix #43475: Styled thick horizontal lines are scrambled
Thick lines are drawn by gdImageFilledRectangle(), which iterates over
the x ordinate first (Z order) to apply the style pattern. While this works
fine for vertical and diagonal lines, it obviously fails for horizontal
lines, which have to be iterated over in N order.

To fix this bug, we introduce the helpers  gdImageFilled(H|V)Rectangle(),
which may be reused for other purposes as well.

This is basically the same fix as libgd/libgd/c2b91dbc.
2016-06-16 13:59:00 +02:00
Christoph M. Becker
f96ebb0986 Fix #66387: Stack overflow with imagefilltoborder
The stack overflow is caused by the recursive algorithm in combination with a
very large negative coordinate passed to gdImageFillToBorder(). As there is
already a clipping for large positive coordinates to the width and height of
the image, it seems to be consequent to clip to zero also.
2016-06-13 08:10:36 +02:00
Pierre Joye
6d3fa654b7 prevent invalid color index (palette only), may lead to crash 2016-06-08 11:06:48 +07:00
Pierre Joye
f80125950c #72337 invalid dimensions can lead to segv 2016-06-07 17:16:40 +07:00
Stanislav Malyshev
544940c48a Merge branch 'PHP-5.5' into PHP-5.6.22
* PHP-5.5:
  Fix memory leak in imagescale()
  Update NEWS
  Better fix for bug #72135
  Fixed bug #72227: imagescale out-of-bounds read
  Fix bug #72241: get_icu_value_internal out-of-bounds read
  Fix bug #72135 - don't create strings with lengths outside int range
  Add check for string overflow to all string add operations
  Fix bug #72114 - int/size_t confusion in fread
  Updated NEWS
  Fixed bug #71331 - Uninitialized pointer in phar_make_dirstream()

Conflicts:
	Zend/zend_operators.c
	ext/phar/dirstream.c
	ext/phar/tests/bug71331.phpt
2016-05-24 16:56:36 -07:00
Stanislav Malyshev
9a826a3bd9 Fix memory leak in imagescale() 2016-05-24 16:12:01 -07:00
Stanislav Malyshev
7a1aac3343 Fixed bug #72227: imagescale out-of-bounds read
Ported from 4f65a3e4ee
2016-05-23 00:34:35 -07:00
Anatol Belski
a21a997478 fix/improve tests 2016-04-27 13:16:57 +02:00
Stanislav Malyshev
e315a162da Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix memory leak
  Fix bug #72099: xml_parse_into_struct segmentation fault
  5.5.36 now
  Fix bug #72094 - Out of bounds heap read access in exif header processing
  Fix bug #72093: bcpowmod accepts negative scale and corrupts _one_ definition
  Fix bug #72061 - Out-of-bounds reads in zif_grapheme_stripos with negative offset
  Fix for bug #71912 (libgd: signedness vulnerability)
  Typo in NEWS

Conflicts:
	configure.in
	main/php_version.h
2016-04-26 23:48:41 -07:00
Stanislav Malyshev
61c7a06e7c Fix memory leak 2016-04-26 22:54:58 -07:00
Stanislav Malyshev
c02301b666 Better fix for #71952 2016-04-19 23:44:00 -07:00
Stanislav Malyshev
f061867fd3 Fix bug #71952: Corruption inside imageaffinematrixget 2016-04-18 23:33:21 -07:00
Stanislav Malyshev
b15f0ecc0f Fix for bug #71912 (libgd: signedness vulnerability) 2016-04-18 22:24:16 -07:00
Remi Collet
aa8d3a8cc6 fix the fix for bug #70976 (imagerotate) 2016-01-12 14:03:35 +01:00
Remi Collet
14e4d393cf fix the fix for bug #70976 (imagerotate) 2016-01-12 13:52:27 +01:00