Commit graph

880 commits

Author SHA1 Message Date
David Carlier
471995c5f7
Merge branch 'PHP-8.3' into PHP-8.4 2025-04-05 15:57:26 +01:00
David Carlier
fe8dffef5d
Fixed GH-18243: imagettftext underflow/overflow on size argument.
close GH-18245
2025-04-05 15:56:45 +01:00
David Carlier
3a5c87f964
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-28 17:31:13 +00:00
David Carlier
a1620048fb
ext/gd: imagecrop rect argument overflow fixes.
```
ext/gd/libgd/gd.c:2275:14: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
    #0 0x5d6a2103e1db in php_gd_gdImageCopy /home/dcarlier/Contribs/php-src/ext/gd/libgd/gd.c:2275
    #1 0x5d6a210a2b63 in gdImageCrop /home/dcarlier/Contribs/php-src/ext/gd/libgd/gd_crop.c:57
    #2 0x5d6a21018ca4 in zif_imagecrop /home/dcarlier/Contribs/php-src/ext/gd/gd.c:3575
    #3 0x5d6a21e46e7a in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/dcarlier/Contribs/php-src/Zend/zend_vm_execute.h:1337
    #4 0x5d6a221188da in execute_ex /home/dcarlier/Contribs/php-src/Zend/zend_vm_execute.h:57246
    #5 0x5d6a221366bd in zend_execute /home/dcarlier/Contribs/php-src/Zend/zend_vm_execute.h:61634
    #6 0x5d6a21d107a6 in zend_execute_scripts /home/dcarlier/Contribs/php-src/Zend/zend.c:1895
    #7 0x5d6a21a63409 in php_execute_script /home/dcarlier/Contribs/php-src/main/main.c:2529
    #8 0x5d6a22516d5e in do_cli /home/dcarlier/Contribs/php-src/sapi/cli/php_cli.c:966
    #9 0x5d6a2251981d in main /home/dcarlier/Contribs/php-src/sapi/cli/php_cli.c:1341
    #10 0x7f10d002a3b7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #11 0x7f10d002a47a in __libc_start_main_impl ../csu/libc-start.c:360
    #12 0x5d6a20a06da4 in _start (/home/dcarlier/Contribs/php-src/sapi/cli/php+0x2806da4) (BuildId: d9a79c7e0e4872311439d7313cb3a81fe04190a2)
```

close GH-18006
2025-03-28 17:30:25 +00:00
David Carlier
bc55177832
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-07 18:07:48 +00:00
David Carlier
07ceadf7d9
Fix GH-17984: gd calls with array arguments.
close GH-17985
2025-03-07 18:07:14 +00:00
David Carlier
dc7b661a60
Fix GH-17703: imagescale both width and heigh set with negative values.
Throwing a ValueError in this particular case.

close GH-17708
2025-02-05 19:39:51 +00:00
Niels Dossche
7b2b2ecab9
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16255: Unexpected nan value in ext/gd/libgd/gd_filter.c
2024-12-16 19:44:50 +01:00
Niels Dossche
6c198e380e
Fix GH-16255: Unexpected nan value in ext/gd/libgd/gd_filter.c
Closes GH-17169.
2024-12-16 19:43:44 +01:00
David Carlier
ec05cd559b
Merge branch 'PHP-8.3' into PHP-8.4 2024-11-13 12:49:13 +00:00
David Carlier
6f1d8368d8
Merge branch 'PHP-8.2' into PHP-8.3 2024-11-13 12:49:00 +00:00
David Carlier
4124b04e34
Fix GH-16771: imagecreatefromstring overflow on invalid format.
close GH-16776
2024-11-13 12:48:37 +00:00
David Carlier
be370edbd7
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-11 19:38:39 +01:00
David Carlier
d612b0a124
Merge branch 'PHP-8.2' into PHP-8.3 2024-10-11 19:38:26 +01:00
David Carlier
f2859a4050
Fix GH-16322: imageaffine overflow on affine argument.
close GH-16334
2024-10-11 19:37:34 +01:00
David Carlier
93a2fe8aac
Revert "Fix GH-16322: overflow on imageaffine matrix argument."
This reverts commit 05114265fb.
2024-10-09 23:57:09 +01:00
David Carlier
05114265fb
Fix GH-16322: overflow on imageaffine matrix argument. 2024-10-09 23:18:23 +01:00
David Carlier
3caa5f8592
Merge branch 'PHP-8.3' into PHP-8.4 2024-10-06 11:02:12 +01:00
David Carlier
fde5e507f6
Merge branch 'PHP-8.2' into PHP-8.3 2024-10-06 11:01:57 +01:00
David Carlier
2d05da2e94
Fix GH-16260: overflow/underflow on imagerotate degrees argument.
close GH-16264
2024-10-06 11:01:17 +01:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
e7c4d54d65 Use new helper function for "cannot be empty" ValueErrors 2024-08-21 21:12:17 +01:00
David CARLIER
93c3ebd209
ext/gd minor corrections concerning image format id for errors. (#14887) 2024-07-09 20:07:07 +01:00
David Carlier
23a55babb4
ext/gd: checking imagescale/imagefilter invalid values.
close GH-14598
2024-07-08 16:59:40 +01:00
Arnaud Le Blanc
11accb5cdf
Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
David CARLIER
1fc083e526
ext/gd: iamgeresolution checks overflow. (#14585) 2024-06-16 23:28:04 +01:00
Giovanni Giacobbi
592d899462
ext/gd: de-factorize image output functions (#14523)
The image output functions imagegif/imagepng/imagewebp/imageavif/imagejpeg
were all calling the static function _php_image_output_ctx which was basically
a big switch statement between each image type which also have different
parameters.

The only identical part was the call to create_stream_context_from_zval that
is now merged with create_output_context.
2024-06-13 09:46:47 +01:00
David CARLIER
1ae544330c
ext/gd using fast ZPP. (#14534) 2024-06-11 09:01:54 +01:00
David Carlier
7b2ca071c5
ext/gd: imagewebp/imageavif/imagepng/imagejpeg stricter checks quality/speed.
close GH-14485
2024-06-05 23:07:57 +01:00
Niels Dossche
7fe03e1a1b
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix parameter numbers for imagecolorset()
2024-06-05 18:04:53 +02:00
Giovanni Giacobbi
da769be7c9
Fix parameter numbers for imagecolorset()
This is the 8.2 & 8.3 version of GH-14477.
2024-06-05 18:01:59 +02:00
Giovanni Giacobbi
44cbdb107e
Fix parameter numbers and missing alpha check for imagecolorset()
The check for the alpha parameter existed in PHP 7.4 but was lost in PHP 8.0.

Fixes: 50765075db

Closes GH-14477.
2024-06-05 17:54:42 +02:00
Niels Dossche
a3a318682a Merge branch 'PHP-8.3'
* PHP-8.3:
  Follow-up fix for GH-13082
2024-01-13 18:02:43 +01:00
Niels Dossche
7065fe3a88 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Follow-up fix for GH-13082
2024-01-13 18:02:25 +01:00
Niels Dossche
df85c2556e Follow-up fix for GH-13082
The font_obj should actually be NULL initialised, not the font gd
pointer.

Closes GH-13139.
2024-01-13 18:01:59 +01:00
David CARLIER
9726721560
general signatures discrepencies fixes (#13122) 2024-01-10 22:19:23 +00:00
David Carlier
7d238bf2d5 Merge branch 'PHP-8.2' into PHP-8.3 2024-01-09 22:01:15 +00:00
David Carlier
1e464e5b55 ext/gd: Fix GH-13082
Issue occur when compiling with recent clang releases (> 13) and
 with the '-Os' optimisation level, after using
`imageloadfont` which returns a proper GdFont class leads to
 a subtle bug when attempting to use via the imagefont* function.
2024-01-09 22:01:00 +00:00
David CARLIER
b0d8c10fd9 ext/gd: imagerotate removes ignore_transparent argument.
seems to be a relic of PHP 5 but no longer makes sense in regard of gdImageRotateInterpolated.

Close GH-11426
2023-06-19 12:32:08 +01:00
Máté Kocsis
101178214c
Declare proper parameter default values for imagegd2 (#10569) 2023-02-23 10:54:55 +01:00
Máté Kocsis
7936c8085e
Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385) 2023-01-23 10:52:14 +01:00
Niels
58d741c042
Remove unnecessary NULL-checks on ctx (#10256)
ctx can never be zero in these functions because they are dispatched
virtually by looking up their entries in ctx. Furthermore, 2 of these
checks never actually worked because ctx was dereferenced before ctx was
NULL-checked.
2023-01-08 12:09:20 +01:00
Stanislav Malyshev
f89284541c Merge branch 'PHP-8.2' 2022-10-23 18:49:34 -06:00
Stanislav Malyshev
dedaf40d21 Merge branch 'PHP-8.1' into PHP-8.2 2022-10-23 18:49:30 -06:00
Stanislav Malyshev
33e10cb1e0 Merge branch 'PHP-8.0' into PHP-8.1 2022-10-23 18:49:26 -06:00
Stanislav Malyshev
1d83a407d1 Merge branch 'PHP-7.4' into PHP-8.0 2022-10-23 18:49:21 -06:00
Christoph M. Becker
d50532be91 Fix #81739: OOB read due to insufficient validation in imageloadfont()
If we swap the byte order of the relevant header bytes, we need to make
sure again that the following multiplication does not overflow.
2022-10-23 18:41:48 -06:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
George Peter Banyard
1ad59b32c2 Update INI validator and displayers depending on INI type
Closes GH-9451
2022-09-06 10:33:34 +01:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00