Commit Graph

1921 Commits

Author SHA1 Message Date
Christoph M. Becker
4bec59f175 Fix #79068: gdTransformAffineCopy() changes interpolation method
We port
<9088591eae>.
2020-01-06 10:36:48 +01:00
Christoph M. Becker
2c5860517c Fix #79067: gdTransformAffineCopy() may use unitialized values
We port
<7a06c1669c>.
2020-01-06 09:35:13 +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
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
Christoph M. Becker
2fc5d00afa Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Add missing skip keyword in tests
2019-10-01 11:15:12 +02:00
Fabien Villepinte
209e37db7d Add missing skip keyword in tests 2019-10-01 11:13:36 +02: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
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
Christoph M. Becker
18a9ae412f Fix #77943: imageantialias($image, false); does not work
Firstly, we must not call `gdImageSetAntiAliased()` (which sets the
color to anti-alias), but rather modify the `gdImage.AA` flag.
Furthermore, we have to actually use the supplied boolean value.

We also make sure that we don't attempt to enable anti-aliasing for
palette images.
2019-04-29 17:23:16 +02:00
Christoph M. Becker
3891e0d13a Add tests for bug77943 2019-04-29 16:29:08 +02:00
Christoph M. Becker
3fc1bdc81c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77943: imageantialias($image, false); does not work
2019-04-29 16:18:27 +02:00
Christoph M. Becker
cd94cf60a2 Fix #77943: imageantialias($image, false); does not work
Firstly, we must not call `gdImageSetAntiAliased()` (which sets the
color to anti-alias), but rather modify the `gdImage.AA` flag.
Furthermore, we have to actually use the supplied boolean value.

We also make sure that we don't attempt to enable anti-aliasing for
palette images.
2019-04-29 16:16:46 +02: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
Christoph M. Becker
2966da70cf Fix failing test 2019-01-19 11:13:13 +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
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
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
1e407256f2 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77272: imagescale() may return image resource on failure
2019-01-10 14:25:11 +01:00
Christoph M. Becker
772b1cb245 Fix #77272: imagescale() may return image resource on failure
`_gdScaleHoriz()` and `_gdScaleVert()` may fail, but don't signal
failure since they are void functions.  We change that according to
upstream libgd.

We also remove the unused `Scale()` function, which doesn't exist in
upstream libgd either, right away.
2019-01-10 14:05:09 +01:00
Stanislav Malyshev
7ed3cfb2e8 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix tests - newer versions check Unicode
  Add NEWS
  Fix test
2019-01-06 13:50:28 -08:00
Stanislav Malyshev
ed4db1bb22 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix test
2019-01-06 12:54:09 -08:00
Stanislav Malyshev
0c35032012 Fix test 2019-01-06 12:30:44 -08:00
Stanislav Malyshev
e40027ef0f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77369 - memcpy with negative length via crafted DNS response
  Fix more issues with encodilng length
  Fix #77270: imagecolormatch Out Of Bounds Write on Heap
  Fix bug #77380  (Global out of bounds read in xmlrpc base64 code)
  Fix bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)
  Fix bug #77370 - check that we do not read past buffer end when parsing multibytes
  Fix #77269: Potential unsigned underflow in gdImageScale
  Fix bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext)
  Fix bug #77242 (heap out of bounds read in xmlrpc_decode())
  Regenerate certs for openssl tests
2019-01-06 12:23:53 -08:00
Stanislav Malyshev
fe820fcba6 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #77369 - memcpy with negative length via crafted DNS response
  Fix more issues with encodilng length
  Fix #77270: imagecolormatch Out Of Bounds Write on Heap
  Fix bug #77380  (Global out of bounds read in xmlrpc base64 code)
  Fix bug #77371 (heap buffer overflow in mb regex functions - compile_string_node)
  Fix bug #77370 - check that we do not read past buffer end when parsing multibytes
  Fix #77269: Potential unsigned underflow in gdImageScale
  Fix bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext)
  Fix bug #77242 (heap out of bounds read in xmlrpc_decode())
  Regenerate certs for openssl tests
2019-01-06 11:57:16 -08:00
Christoph M. Becker
567c9f5842 Fix #77270: imagecolormatch Out Of Bounds Write on Heap
At least some of the image reading functions may return images which
use color indexes greater than or equal to im->colorsTotal.  We cater
to this by always using a buffer size which is sufficient for
`gdMaxColors` in `gdImageColorMatch()`.
2019-01-06 11:38:46 -08:00
Christoph M. Becker
dfd8237aec Fix #77269: Potential unsigned underflow in gdImageScale
Belatedly, we're porting the respective upstream patch[1].

[1] <60bfb401ad>
2019-01-06 11:38:46 -08: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
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
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
aab9aa7661 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix test case
2018-11-24 13:38:09 +01:00
Christoph M. Becker
5af5f56fc9 Fix test case 2018-11-24 13:36:42 +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
b746e69887 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:32:30 +02:00
Peter Kokot
f1d7e3ca0b Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:31:31 +02:00
Peter Kokot
113213f027 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:29:24 +02:00
Peter Kokot
782352c54a Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
Peter Kokot
17ccbeec32 Trim trailing whitespace in *.phpt 2018-10-14 19:44:14 +02:00
Peter Kokot
7af945e271 Trim trailing whitespace in *.phpt 2018-10-14 19:43:12 +02:00