summaryrefslogtreecommitdiff
path: root/ext/gd
Commit message (Collapse)AuthorAgeFilesLines
* Use ZEND_HASH_FOREACH APIs in a few more placesNikita Popov2019-07-161-6/+2
|
* Use e.g. instead of less common f.e. [ci skip]Peter Kokot2019-07-091-1/+1
|
* Remove HAVE_ERRNO_H from libgdPeter Kokot2019-06-281-6/+0
| | | | | | | | The check for errno.h has been removed via 50b9ef8d9435d23be40cea7fb484a02e99fdb617 Upstream libgd library is also patched via https://github.com/libgd/libgd/commit/1e7f93922fb3adf9f131d7e94aa13386062ffe11
* Properly shut down font cache mutexChristoph M. Becker2019-06-212-1/+13
| | | | | Since the font cache mutex in set up in MINIT, we have to shut it down in MSHUTDOWN.
* Support TGA readingChristoph M. Becker2019-06-2013-2/+503
| | | | | | | | | | | We add PHP bindings for libgd's features to read TGA 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. Since TGA has no easily recognizable file signature, we don't add TGA support for imagecreatefromstring() or getimagesize() and friends.
* imagecolorallocate(): Check that RGB components are in-rangeNikita Popov2019-06-203-15/+92
| | | | Instead of letting them bleed over into other components.
* Suppress shift UB in gd_itofx()Nikita Popov2019-06-191-2/+2
| | | | There doesn't seem to be a corresponding upstream fix for this.
* imageloadfont: Perform overflow check before calculationNikita Popov2019-06-191-7/+7
| | | | Instead of afterwards...
* Fix buffer underflow in gd_gif_in.cNikita Popov2019-06-191-1/+1
| | | | | This has been fixed upstream in https://github.com/libgd/libgd/commit/939d49a3a9d1cbcd2a37cea9eac9f9e5e9f9de78.
* Fix shift UB in gd_io.cNikita Popov2019-06-191-2/+2
| | | | | | | This has already been fixed upstream in https://github.com/libgd/libgd/commit/24d352576c024769d18113a28f3be03d54fa1e66 and https://github.com/libgd/libgd/commit/772d0107a6b00a0d6d7191383fe984f8c018b48c.
* Add BMP support to PHP infoChristoph M. Becker2019-06-131-0/+3
|
* Simplify GD null byte injection testsChristoph M. Becker2019-06-129-126/+43
| | | | | | | | | These tests actually check that no file with a name containing a NUL is created by the GD image output functions. This is superfluous, since it is sufficient to check that the function failed, and that an appropriate warning has been raised. We also add missing nullbyte injection tests.
* fix flaky gd testsJoe Watkins2019-06-127-50/+41
|
* Remove unused _setEdgePixel() and getPixelOverflowColorTC() functionsNikita Popov2019-06-111-56/+0
|
* Fix fabs warning in gd_interpolation.cNikita Popov2019-06-111-2/+2
| | | | Matches upstream code.
* Remove safeboolean use in gd_jpeg.cNikita Popov2019-06-111-16/+3
| | | | | This is a backport of https://github.com/libgd/libgd/blob/e5502c7a3f1fe60536ec060f0211d97066c006ea/src/gd_jpeg.c.
* Fix abs(long) warnings in gd.cNikita Popov2019-06-111-1/+1
| | | | | I'm fixing this using (int) casts instead of labs() because this is what upstream GD does.
* Allow exceptions in __toString()Nikita Popov2019-06-051-1/+4
| | | | | | | | | | RFC: https://wiki.php.net/rfc/tostring_exceptions And convert some object to string conversion related recoverable fatal errors into Error exceptions. Improve exception safety of internal code performing string conversions.
* Merge branch 'PHP-7.3' into PHP-7.4Stanislav Malyshev2019-05-271-1/+1
|\ | | | | | | | | * PHP-7.3: Fix function name
| * Merge branch 'PHP-7.2' into PHP-7.3Stanislav Malyshev2019-05-271-1/+1
| |\ | | | | | | | | | | | | * PHP-7.2: Fix function name
| | * Fix function nameStanislav Malyshev2019-05-271-1/+1
| | |
* | | Merge branch 'PHP-7.3' into PHP-7.4Stanislav Malyshev2019-05-272-1/+31
|\ \ \ | |/ / | | | | | | | | | | | | | | | * PHP-7.3: 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
| * | Merge branch 'PHP-7.2' into PHP-7.3Stanislav Malyshev2019-05-272-1/+31
| |\ \ | | |/ | | | | | | | | | | | | | | | * 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
| | * Merge branch 'PHP-7.1' into PHP-7.2Stanislav Malyshev2019-05-272-1/+31
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | | * Fix #77973: Uninitialized read in gdImageCreateFromXbmChristoph M. Becker2019-05-272-1/+31
| | | | | | | | | | | | | | | | | | | | We have to ensure that `sscanf()` does indeed read a hex value here, and bail out otherwise.
| | * | Fix #77943: imageantialias($image, false); does not workChristoph M. Becker2019-04-291-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | Add tests for bug77943Christoph M. Becker2019-04-292-0/+29
| | | |
* | | | [ci skip] Refactor libgd docsPeter Kokot2019-05-122-125/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes to simplify managing libgd docs a bit: - Move copyright statement and licensing info to common redistributable bins file. All previous notices left intact and updated with the upstream info. - Remove unsynced and difficult to track README file compared to upstream README.md file available at https://github.com/libgd/libgd
* | | | Normalize comments in *nix build system m4 filesPeter Kokot2019-05-121-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normalization include: - Use dnl for everything that can be ommitted when configure is built in favor of the shell comment character # which is visible in the output. - Line length normalized to 80 columns - Dots for most of the one line sentences - Macro definitions include similar pattern header comments now
* | | | Rename *.jpeg files to *.jpgPeter Kokot2019-05-1110-8/+8
| | | | | | | | | | | | | | | | | | | | These file extensions are not part of these tests and *.jpg is more common.
* | | | Implemented the gdScatter filter I wrote almost 10 years agoKalle Sommer Nielsen2019-05-104-2/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This filter is available as of libgd 2.1.0 which is our bare minimum for external compilation of ext/gd. The scatter filter works by iterating over all pixels in the image and shifting them randomly based on two modifier (`plus` and `sub`) values: dest_x = (int)(x + ((rand() % (plus - sub)) + sub)); dest_y = (int)(y + ((rand() % (plus - sub)) + sub)); Additionally the scatter filter also supports by only shifting pixels where the current pixel being iterated is one or more colors, allowing the scatter filter to only effect solid colors in part of an image. Note, due to the nature of randomness and implementation, pixels who were shifted ahead of iteration will be shifted once more and therefore the bottom right of an image may contain a slight scatter effect due to this.
* | | | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2019-04-293-1/+34
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.3: Fix #77943: imageantialias($image, false); does not work
| * | | Merge branch 'PHP-7.2' into PHP-7.3Christoph M. Becker2019-04-293-1/+34
| |\ \ \ | | | | | | | | | | | | | | | | | | | | * PHP-7.2: Fix #77943: imageantialias($image, false); does not work
| | * | | Fix #77943: imageantialias($image, false); does not workChristoph M. Becker2019-04-293-1/+34
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Added test for imagecolorclosesthwbRodrigo Prado2019-04-201-0/+35
| | | | | | | | | | | | | | | | | | | | The function was not tested yet. See http://gcov.php.net/viewer.php?version=PHP_HEAD&func=tested_functions
* | | | Fix uninit warning in gd.cNikita Popov2019-04-121-1/+1
| | | | | | | | | | | | | | | | This matches the upstream implementation.
* | | | Fix libgd warningsNikita Popov2019-04-113-3/+8
| | | |
* | | | Remove unused variablesFabien Villepinte2019-03-173-6/+4
| | | |
* | | | Replace dirname(__FILE__) by __DIR__ in testsFabien Villepinte2019-03-1565-87/+87
| | | |
* | | | Add AS_HELP_STRING to *nix build configure optionsPeter Kokot2019-03-071-17/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Autoconf's default AS_HELP_STRING macro can properly format help strings [1] so watching out if columns are aligned manually is not anymore. [1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Pretty-Help-Strings
* | | | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2019-03-062-1/+25
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.3: Fix #77700: Writing truecolor images as GIF ignores interlace flag
| * | | Merge branch 'PHP-7.2' into PHP-7.3Christoph M. Becker2019-03-062-1/+25
| |\ \ \ | | |/ / | | | | | | | | | | | | * PHP-7.2: Fix #77700: Writing truecolor images as GIF ignores interlace flag
| | * | Fix #77700: Writing truecolor images as GIF ignores interlace flagChristoph M. Becker2019-03-062-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Remove more zpp error/variation testsNikita Popov2019-03-0581-1596/+0
| | | |
* | | | Use separate output files in x2gd testsNikita Popov2019-03-044-20/+20
| | | |
* | | | Remove dead codeChristoph M. Becker2019-02-282-35/+4
| | | | | | | | | | | | | | | | | | | | | | | | `_php_image_output()` is only ever called for `PHP_GDIMG_CONVERT_WBM`, `PHP_GDIMG_TYPE_GD` and `PHP_GDIMG_TYPE_GD2`. All other image types solely use the more flexible `_php_image_output_ctx()`.
* | | | gd imageloadfont, verify error while reading headerBlackEagle2019-02-191-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | when reading the header verify we get an error when the header is invalid. Signed-off-by: BlackEagle <ike.devolder@gmail.com>
* | | | gd imageloadfont test while reading headerBlackEagle2019-02-141-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Cover error when the header of an gd font loading is interrupted by end of file. Signed-off-by: BlackEagle <ike.devolder@gmail.com>
* | | | Remove zpp variation testsNikita Popov2019-02-054-910/+0
| | | |
* | | | Remove local variablesPeter Kokot2019-02-033-27/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the so called local variables defined per file basis for certain editors to properly show tab width, and similar settings. These are mainly used by Vim and Emacs editors yet with recent changes the once working definitions don't work anymore in Vim without custom plugins or additional configuration. Neither are these settings synced across the PHP code base. A simpler and better approach is EditorConfig and fixing code using some code style fixing tools in the future instead. This patch also removes the so called modelines for Vim. Modelines allow Vim editor specifically to set some editor configuration such as syntax highlighting, indentation style and tab width to be set in the first line or the last 5 lines per file basis. Since the php test files have syntax highlighting already set in most editors properly and EditorConfig takes care of the indentation settings, this patch removes these as well for the Vim 6.0 and newer versions. With the removal of local variables for certain editors such as Emacs and Vim, the footer is also probably not needed anymore when creating extensions using ext_skel.php script. Additionally, Vim modelines for setting php syntax and some editor settings has been removed from some *.phpt files. All these are mostly not relevant for phpt files neither work properly in the middle of the file.