Commit graph

666 commits

Author SHA1 Message Date
Christoph M. Becker
c670b622ab Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #77391: 1bpp BMPs may fail to be loaded
2018-12-31 20:52:27 +01:00
Christoph M. Becker
6f663c3a2e Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77391: 1bpp BMPs may fail to be loaded
2018-12-31 20:50:19 +01:00
Christoph M. Becker
b0cfa28d6d Fix #77391: 1bpp BMPs may fail to be loaded
We port the upstream fix[1].

[1] <d0859134fc>
2018-12-31 20:45:47 +01:00
Christoph M. Becker
dcad13e8c9 Fix #73291: imagecropauto() $threshold differs from external libgd
Since upstream does not appear to move in any way[1], we sync our
behavior.  Even though the BC break is ugly (which is the reason we
target master only), having to deal with different algorithms is even
worse for portable userland code.

[1] <https://github.com/libgd/libgd/issues/334>
2018-12-01 18:49:30 +01:00
Christoph M. Becker
947ca9f43d Sync behavior of gdImageAutoCrop() with upstream
Since cropping support has been added to our bundled libgd,
`gdImageAutoCrop` differs from upstream in that `GD_CROP_DEFAULT` falls
back on `GD_CROP_SIDES` if there is no transparent color in the image.
While this difference seem to be a useful improvement in our bundled
libgd, upstream has not yet signaled that there willing to back-port
it[1], so we revert it to stay in sync with upstream.

We also remove the additional NULL bailout at the end of the function,
which doesn't appear to be relevant any longer since bug 77198 has been
fixed.

[1] <https://github.com/libgd/libgd/issues/298>
2018-12-01 15:34:10 +01:00
Christoph M. Becker
9a5669bc7b Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #77200: imagecropauto(…, GD_CROP_SIDES) crops left but not right
2018-11-25 19:04:03 +01:00
Christoph M. Becker
070f6838db Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77200: imagecropauto(…, GD_CROP_SIDES) crops left but not right
2018-11-25 19:03:38 +01:00
Christoph M. Becker
a1aaec08b5 Fix #77200: imagecropauto(…, GD_CROP_SIDES) crops left but not right
We apply the upstream patch[1].

[1] <6613094e5d>
2018-11-25 19:00:50 +01:00
Christoph M. Becker
65b34bfa1e Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #77198: auto cropping has insufficient precision
2018-11-25 15:57:25 +01:00
Christoph M. Becker
d2a1839d82 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77198: auto cropping has insufficient precision
2018-11-25 15:56:35 +01:00
Christoph M. Becker
b47b8886dd Fix #77198: auto cropping has insufficient precision
We apply the upstream patch[1], and also fix the erroneous bailout at
the end of `gdImageAutoCrop()`, since `crop.x` and `crop.y` may very
well be zero.

[1] <bda85aaeeb>
2018-11-25 15:41:27 +01:00
Christoph M. Becker
2e4b6624cb Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #77195: Incorrect error handling of imagecreatefromjpeg()
2018-11-24 12:58:57 +01:00
Christoph M. Becker
caabf3a1bb Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77195: Incorrect error handling of imagecreatefromjpeg()
2018-11-24 12:57:44 +01:00
Christoph M. Becker
60a9f7a3a3 Fix #77195: Incorrect error handling of imagecreatefromjpeg()
The broken JPEG image triggers a notice, two warnings and outputs a
message to stderr directly.  The additional notice is pretty useless,
and the direct output to stderr is bad.  Therefore, we port the
relevant differences from upstream to our bundled libgd.  This leaves
us with two warnings; the first one is triggered by libjpeg and shows
the actual problem, the second one is triggered by our libgd wrapper
whenever an image can't be read, what may not have necessarily
triggered a warning before.
2018-11-24 12:52:08 +01:00
Peter Kokot
dcc529aff4 Remove HAVE_SYS_VARARGS_H
Outdated systems used to provide the `<varargs.h>` and in case of PHP
`<sys/varargs.h>`. [1]

Current systems have `<stdarg.h>` which is also a C89 standard header
and systems have it always present. [2]

[1] https://en.wikipedia.org/wiki/Stdarg.h#varargs.h
[2] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2
2018-09-16 20:50:20 +02:00
Gabriel Caruso
9e4d590b19
Remove extra semicolons 2018-07-25 21:47:04 -03:00
Christoph M. Becker
ab592df5dd Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix #52070: imagedashedline() - dashed line sometimes is not visible
2018-03-30 19:39:44 +02:00
Christoph M. Becker
76f421dd3a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #52070: imagedashedline() - dashed line sometimes is not visible
2018-03-30 19:29:10 +02:00
Christoph M. Becker
9c37d95627 Fix #52070: imagedashedline() - dashed line sometimes is not visible
We finally remove the inadvertent leftover from the synchronization
with GD 2.0.12.
2018-03-30 19:22:23 +02:00
Christoph M. Becker
eeda55cb3b Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix #76041: null pointer access crashed php
2018-03-02 17:21:04 +01:00
Christoph M. Becker
d83467d70b Fix #76041: null pointer access crashed php
We must not draw anti-aliased lines on palette images, because that is
not supported by `gdImageSetAAPixelColor()` and it wouldn't make much
sense to support it, due to the limitation to at most 256 colors.
2018-03-02 17:18:45 +01:00
Gabriel Caruso
a5f1a585e6 Removed unused variables 2018-02-11 22:46:33 +01:00
Christoph M. Becker
70fec8a1cc Align overflow error messages with upstream
This particularly fixes two tests (bug66356.phpt and bug72339.phpt) if
PHP has been build with an external libgd.
2018-02-10 15:41:33 +01:00
Christoph M. Becker
c8ba185cf9 Remove unused function 2018-02-09 17:39:24 +01:00
Gabriel Caruso
2d48d734a2 Fix some misspellings 2018-02-06 16:59:00 +01:00
Christoph M. Becker
c73e8a07a5 Remove unused variable
We're not interested in the return value of
`gdGuessBackgroundColorFromCorners`, so there's no need to track it.

See also libgd/libgd@535eab566b.
2018-02-06 14:59:23 +01:00
Christoph M. Becker
b309f645f9 Sync gdImageCrop() with upstream
Besides that we still hope to sync the complete bundled libgd sometime,
the upstream implementation of `gdImageCrop()` is much simpler than the
current one, and thus better readable and less error prone.
2018-02-02 17:39:23 +01:00
Gabriel Caruso
6400264856 Trailing whitespaces
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-03 14:38:00 +01:00
Xinchen Hui
a7fe2570d3 Merge branch 'master' of git.php.net:/php-src
* 'master' of git.php.net:/php-src:
  Update NEWS
  Fixed bug #75571: Potential infinite loop in gdImageCreateFromGifCtx
  Fix bug #74782: remove file name from output to avoid XSS
2018-01-02 13:50:40 +08:00
Xinchen Hui
e8eb52dc98 Merge branch 'PHP-7.2' of git.php.net:/php-src into PHP-7.2
* 'PHP-7.2' of git.php.net:/php-src:
  Update NEWS
  Fixed bug #75571: Potential infinite loop in gdImageCreateFromGifCtx
  Fix bug #74782: remove file name from output to avoid XSS
2018-01-02 13:50:18 +08:00
Xinchen Hui
bd23bcec3e Merge branch 'PHP-7.1' of git.php.net:/php-src into PHP-7.1
* 'PHP-7.1' of git.php.net:/php-src:
  Update NEWS
  Fixed bug #75571: Potential infinite loop in gdImageCreateFromGifCtx
  Fix bug #74782: remove file name from output to avoid XSS
2018-01-02 13:49:58 +08:00
Stanislav Malyshev
a68dc899bb Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS
  Fixed bug #75571: Potential infinite loop in gdImageCreateFromGifCtx
  Fix bug #74782: remove file name from output to avoid XSS
2018-01-01 21:07:21 -08:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Stanislav Malyshev
459ab2eef4 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Update NEWS
  Fixed bug #75571: Potential infinite loop in gdImageCreateFromGifCtx
  Fix bug #74782: remove file name from output to avoid XSS
2018-01-01 20:28:01 -08:00
Christoph M. Becker
8d6e958867 Fixed bug #75571: Potential infinite loop in gdImageCreateFromGifCtx
Due to a signedness confusion in `GetCode_` a corrupt GIF file can
trigger an infinite loop.  Furthermore we make sure that a GIF without
any palette entries is treated as invalid *after* open palette entries
have been removed.
2018-01-01 19:51:26 -08:00
Christoph M. Becker
995ac8a094 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Define floorf if system doesn't have it (follow up for 22c48761)
2017-11-29 16:59:17 +01:00
Lior Kaplan
32e3d7b99e Define floorf if system doesn't have it (follow up for 22c48761)
floorf is checked in config.m4
2017-11-29 16:46:47 +01:00
Christoph M. Becker
c04617aa61 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #65148 (imagerotate may alter image dimensions)
2017-10-24 17:17:18 +02:00
Christoph M. Becker
22c487616f Fixed bug #65148 (imagerotate may alter image dimensions)
We apply the respective patches from external libgd, work around the
still missing `gdImageClone()`, and fix the special cased rotation
routines according to Pierre's patch
(https://gist.github.com/pierrejoye/59d72385ed1888cf8894a7ed437235ae).

We also cater to bug73272.phpt whose result obviously changes a bit.
2017-10-24 17:02:56 +02:00
Anatol Belski
9beb743b07 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix memory leak
2017-10-23 15:40:37 +02:00
Anatol Belski
1cb2079d6c Fix memory leak 2017-10-23 15:26:08 +02:00
Christoph M. Becker
b4dc3de5ab Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75139 (libgd/gd_interpolation.c:1786: suspicious if ?)
2017-09-02 00:20:46 +02:00
Christoph M. Becker
e20a6b0213 Fixed bug #75139 (libgd/gd_interpolation.c:1786: suspicious if ?)
We back-port dd48286 even though
we cannot come up with a regression test, because the erroneous
condition appears to be impossible to trigger.

We also parenthesize the inner ternary operation to avoid confusion.
2017-09-02 00:04:02 +02:00
Christoph M. Becker
1aeafb7d4a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75124 (gdImageGrayScale() may produce colors)
2017-08-27 14:07:55 +02:00
Christoph M. Becker
499f5480f1 Fixed bug #75124 (gdImageGrayScale() may produce colors)
We have to make sure to avoid alpha-blending issues by explicitly
switching to `gdEffectReplace` and to restore the old value afterwards.

This is a port of <a7a7ece>.
2017-08-27 13:53:39 +02:00
Christoph M. Becker
5cd348c1d6 Fixed bug #75111 (Memory disclosure or DoS via crafted .bmp image)
Crafted BMP images can cause dynamicSeek() to be called with a negative
position which must not be allowed, since dynamicSeek() works like
fseek() in SEEK_SET mode. We solve this by bailing out if `pos` is
negative, and let the image reading fail gracefully.
2017-08-24 14:07:10 +02:00
Stanislav Malyshev
d75dbb0e31 Merge branch 'PHP-7.1'
* PHP-7.1:
  Improve fix for #74145
  Fix wddx
  Fix tests
  Fixed bug #74111
  Fix bug #74603 - use correct buffer size
  Fix bug #74651 - check EVP_SealInit as it can return -1
  Update NEWS
  Fix bug #74087
  Fixed parsing of strange formats with mixed month/day and time strings
  Fix bug #74145 - wddx parsing empty boolean tag leads to SIGSEGV
  Fixed bug #74111
  Fix #74435: Buffer over-read into uninitialized memory
  Fix bug #74603 - use correct buffer size
  Fix bug #74651 - check EVP_SealInit as it can return -1
  Update NEWS
  Fix bug #73807
2017-07-04 21:23:16 -07:00
Stanislav Malyshev
0496f5407f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Update NEWS
  Fix bug #74087
  Fixed parsing of strange formats with mixed month/day and time strings
  Fix bug #74145 - wddx parsing empty boolean tag leads to SIGSEGV
  Fixed bug #74111
  Fix #74435: Buffer over-read into uninitialized memory
  Fix bug #74603 - use correct buffer size
  Fix bug #74651 - check EVP_SealInit as it can return -1
  Update NEWS
  Fix bug #73807
2017-07-04 19:44:51 -07:00