summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Allow GIFs missing both Global and Local Colormaps to still decode (#494)az66672021-03-036-0/+35
| | | | | | | | | | | | | | | | | | Ensure that a GIF without any Global or Local color tables is still decoded by libgd. GIF89a spec indicates conforming image files need not have Global or Local color tables at all. Spec recommends creating custom color map in that situation, and that at least Black+White as first two entries, to ensure B&W images are decoded. Some commonly used single-pixel GIFs found around the web are undecoded by libgd otherwise. Test case has been included. References: https://www.w3.org/Graphics/GIF/spec-gif89a.txt http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever
* HEIF support through libheif (#670)Martin Reboredo2021-03-0212-1/+180
| | | | | | | | | | | | | | | With the adoption of AVIF by Firefox and Chromium based browsers (still in experimental phase), the newer incorporation of HEIF by Canon and Sony in their cameras and the newer support of both of them in modern software like ImageMagick, GIMP and Krita, `gd` haven't seen any endorsement for the formats up until this PR. Reading and writing is done by `libheif`, with functionality for chroma subsampling (for now `4:2:0`, `4:2:2` and `4:4:4`), quality (with new `200` for lossless) and compression (whether `HEVC` or `AV1`) selection. This was tested with `libheif` version `1.11.0` in my Solus machine. Also, fixes both #395 and #557.
* scripts: clean up various shellcheck warningsMike Frysinger2021-02-081-7/+6
| | | | Should hopefully not break anything :).
* tests/gdimageline/gdimageline_bug5: add im null judgement (#624)wilson chen2020-05-201-0/+6
| | | gdImageCreate returns NULL in gdimageline_bug5.c on AIX, which make the judgement necessary in case of segment fault.
* Fix #615: gdImageStringFT() fails for empty strings as of libgd 2.3.0 (#633)Christoph M. Becker2020-05-054-0/+28
| | | | | | We change the return type of `textLayout()` to `ssize_t`, and signal failure by returning `-1`, so that laying out an empty string is no longer handled as failure. We make sure that no overflow occurs, assuming that all `int` values can be fully represented as `ssize_t`.
* Improve test cases for gdImageString16 and gdImageStringUp16 (#625)wilson chen2020-04-152-8/+4
| | | | Fixed #623. wchar_t is 32 bits on 64-bits AIX, which will result in test case failure. So we replace wchar_t with unsigned short array.
* Fixed test case build configure error in issue #626wilson chen2020-04-131-1/+3
|
* tests/gdtest/CMakeLists.txt: include readdir.c under win (#520)wilson chen2020-04-011-1/+5
| | | @pierrejoye has implemented opendir, closedir and readdir in readdir.c, which is only used under windows platform. These functions are enabled by modifiying the tests/gdTest/CMakeLists.txt
* Fix two build configure errors in tests (#616)wilson chen2020-03-283-2/+11
| | | | tests/webp/bug_double_free should depend on webp and jpeg. tests/gdimagesquaretocircle should depend on png.
* Fixed #596: gdTransformAffineCopy run errorwilson chen2020-03-216-2/+47
| | | And add test case for it.
* Fix some memory leakage in test caseswilson chen2020-03-213-1/+9
| | | | Fix the memory leakage in following test cases: tests/bug_overflow_lagre_new_size.c, tests/gdimagecrop/bug00486.c, tests/bmp/bug00450.c
* tests/gif/bug00006.c: fix memory leakagewilson chen2020-03-171-0/+1
|
* add testcase for gdimagesquaretocircle()wilson chen2020-03-087-0/+48
|
* Add testcase for gdimagecompare()wilson chen2020-03-076-0/+68
|
* add testcase for gdimagecreatefromgd2partwilson chen2020-02-264-0/+38
|
* Fix #301: brect boundswilson chen2020-02-251-16/+16
| | | | According to the result, the extra one pixel is unnessary. Deleting the related code block makes the image looks fine.
* Fixed #169: update var type to hold bigger w&h for ellipse (#565)wilson chen2020-02-0912-0/+66
| | | Update var type to hold bigger w&h for ellipse. And add corresponding test cases.
* add testcase gdImageCopyResizedwilson chen2020-01-237-0/+53
|
* Fix #586: gdTransformAffineCopy() segfaults on palette imagesChristoph M. Becker2020-01-054-1/+30
| | | | We have to properly distinguish between truecolor and palette images.
* Fix #585: gdTransformAffineCopy() changes interpolation methodChristoph M. Becker2020-01-044-1/+37
| | | | We have to properly initialize `interpolation_id_bak`.
* Remove trailing whitespaceChristoph M. Becker2020-01-041-1/+1
|
* Fix #584: gdImageSetInterpolationMethod(im, GD_DEFAULT) inconsistentChristoph M. Becker2020-01-046-0/+44
| | | | We have to avoid the unintended fall through.
* Fix #583: gdTransformAffineCopy() may use unitialized valuesChristoph M. Becker2020-01-046-0/+43
| | | | | We have to check the return value of `gdAffineInvert()`, and on failure let `gdTransformAffineCopy()` fail as well.
* add testcase for gdImageWebpExwilson chen2020-01-044-1/+30
|
* tests: Correct some test depend errorswilson chen2020-01-0231-89/+28
|
* add testcase for gdimagecreatefromgd2partptrwilson chen2019-12-244-0/+62
|
* Fix potential NULL pointer dereference in gdImageClone()Fábio Cabral Pacheco2019-12-204-1/+34
|
* Fix #497: gdImageColorMatch Out Of Bounds Write on Heap (CVE-2019-6977)wilson chen2019-12-204-0/+28
| | | | | | Fixed CVE-2019-6977 and add corresponding testcase. Original patch by Christoph M. Bechker <cmbecker69@gmx.de> https://gist.github.com/cmb69/1f36d285eb297ed326f5c821d7aafced
* Fixed #369: fix new_a init error in gdImageConvolution()willson-chen2019-12-134-0/+34
|
* add testcase for gdImageColorClosestHWBwillson-chen2019-11-286-0/+43
| | | | add testcase for gdImageColorClosestHWB
* add testcase for gdImageColorMatchwillson-chen2019-11-286-0/+45
| | | | add testcase for gdImageColorMatch
* add testcase for gdimagestringupwilson chen2019-11-287-0/+52
|
* add testcase for gdImageStringUp16wilson chen2019-11-287-0/+49
|
* add testcase for gdImageString16wilson chen2019-11-287-0/+50
|
* add testcase for gdImageCopyMergeGraywilson chen2019-11-287-0/+56
|
* add testcase for gdimagestringwilson chen2019-11-277-0/+52
|
* add testcase for gdImageCopyMergewilson chen2019-11-277-0/+56
|
* update gdtest.c to support msys (#528)willson-chen2019-10-281-7/+16
| | | | | | | * config.h is never generated in msys with existing windows/msys/Makefile * errno.h is to solve EEXIST is not defined error * GDTEST_TOP_DIR is defined in other compile ways except msys and test_config.h is created by windows/msys/run_test.sh * Ui64 is only created by microsoft by not support in windows and ULL is common used and general supported * _int64 is only support by vc but __int64 can be support in win
* CMakeLists.txt: Exclude libm dependency under winwillson-chen2019-10-262-2/+2
| | | | * CMakeLists.txt: Exclude libm dependency under win * CMakeLists.txt: Move win32/m logic into cmake/modules/gd.cmake
* Delete unused marcos #311willson-chen2019-10-221-2/+0
|
* Add a test for issue libgd#501 CVE-2019-11038Lance Wang2019-09-025-1/+53
| | | | | When using gdImageCreateFromXbm() it is possible to supply data that will cause the function to use the value of uninitialized variable.
* Fix #499: gdImageGifAnimAddPtr: heap corruption with 2 identical imagesChristoph M. Becker2019-05-264-0/+54
| | | | | | | | Whenever `gdImageGifAnimAddPtr()` calls `gdImageGifAnimAddCtx()` and the latter fails, we must not call `gdDPExtractData()`; otherwise a double-free would occur. Since `gdImageGifAnimAddCtx` is a void function, and we can't change that for BC reasons, we're introducing a static helper which is used internally.
* tests: cmake: list appending instead of set(Andrew Burley2019-02-093-3/+3
| | | | Consistent use of LIST(APPEND over SET(
* tests: cmake: feature enable lists - building w/o libpng enabled failing ↵Andrew Burley2019-02-091-1/+6
| | | | again. #382
* add stub ABI funcs when formats are disabled #345Mike Frysinger2019-02-091-6/+0
| | | | | | We do this for some funcs already, so add jpeg/png/tiff/liq/webp stubs too. This keeps our ABI stable and lets code do runtime detection instead.
* Fix #492: Potential double-free in gdImage*Ptr()Christoph M. Becker2019-01-174-1/+35
| | | | | | | | | | | | | | | Whenever `gdImage*Ptr()` calls `gdImage*Ctx()` and the latter fails, we must not call `gdDPExtractData()`; otherwise a double-free would happen. Since `gdImage*Ctx()` are void functions, and we can't change that for BC reasons, we're introducing static helpers which are used internally. We're adding a regression test for `gdImageJpegPtr()`, but not for `gdImageGifPtr()` and `gdImageWbmpPtr()` since we don't know how to trigger failure of the respective `gdImage*Ctx()` calls. This potential security issue has been reported by Solmaz Salimi (aka. Rooney).
* Remove trailing whitespaceChristoph M. Becker2019-01-161-1/+1
|
* Fix #351: gdImageFilledArc() doesn't properly draw piesChristoph M. Becker2019-01-165-0/+34
| | | | | | | | | | | 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. [1] <https://bugs.php.net/bug.php?id=43828>
* Fix #450: Failed to open 1 bit per pixel bitmapRomain DÉOUX2018-12-316-2/+43
| | | | | For 1 bit per pixel bitmap images, when the width of the image match some specific values (for instance, 10px), the image loading fails.
* Fix #486: gdImageCropAuto(…, GD_CROP_SIDES) crops left but not rightChristoph M. Becker2018-11-254-0/+47
| | | | | `gdGuessBackgroundColorFromCorners()` is supposed to handle *all* cases where an image has exactly two equal colors in the same way.