Commit Graph

444 Commits (6013c7bcf6eb795dba584f92d3824ebd3ae60202)

Author SHA1 Message Date
Pierre Joye 1f70ada0e4 not used 2021-08-17 06:26:29 +07:00
Pierre Joye b68f9a34c0 fix leaks in tests and extend a bit the timeout for ASAN mode 2021-08-13 21:57:22 +07:00
Pierre Joye bd72a7da40 WebP: Fix memory leak in test and avoid possible memory leak if size is not correct (ie. passing 0 size will leak). Min size is the WebP sign (3x32bits) 2021-08-13 21:14:36 +07:00
Adam Silverstein b3d1986e29 Clean formatting. 2021-05-05 11:50:28 -06:00
Adam Silverstein a2b3ba08ef Merge branch 'master' into webp-lossless
# Conflicts:
#	tests/webp/.gitignore
#	tests/webp/CMakeLists.txt
#	tests/webp/Makemodule.am
2021-05-05 09:30:02 -06:00
Remi Collet 1e47a89a65 fix #655 relax test when libraqm is used 2021-03-18 09:59:05 +01:00
Martin Reboredo f7d12c91fa
Permit compilation with libheif version 1.7.0 (#686)
libheif versions that came before 1.9.0 don't support changing the output image chroma.
I did not notice that and it resulted with tests failures across other OSes that don't have
a much newer libheif.

See #678. Supersedes #685.
2021-03-16 11:53:16 -04:00
Remi Collet 048cb47f20 add missing image for heif test 2021-03-16 10:51:22 +01:00
Mike Frysinger 6ca52e78bc avif: simplify tests with gdtest helpers 2021-03-06 13:55:40 -05:00
Mike Frysinger b04ff8dbc7 avif: add test images to dist 2021-03-06 13:55:06 -05:00
Martin Reboredo 3d142367bb
HEIF codecs check in test suite (#676)
Use the heif_have_decoder_for_format and heif_have_encoder_for_format
functions to find if HEVC decoding/encoding is supported by libheif.

Fixes #675.
2021-03-06 13:18:31 -05:00
Mike Frysinger 122799495c avif: fix build warnings in new code 2021-03-04 21:34:16 -05:00
Ben Morss f2aa2836ed
AVIF support (#671)
Demand for AVIF support on the web is growing, as the word gets out
about this new file format which allows higher-quality encoding at
smaller sizes.  Core contributors to major open-source CMSs are
interested in auto-generating AVIF images! They've been simply
waiting for support to appear in libgd.

This PR aims to meet the growing demand, and to help bring smaller,
more beautiful images to more of the web - to sites created by
experienced developers and CMS users alike.

This PR adds support by incorporating libavif in addition to the
existing libheif support.  It's generally felt that libavif has
more complete support for the AVIF format. libavif is also used
by the Chromium project and squoosh.app.

In this PR, I've endeavored to incorporate the latest research into
best practices for AVIF encoding - not just for default quantizer
values, but also an algorithm for determining the number of
horizontal tiles, vertical tiles, and threads.

Fixes #557.
2021-03-03 21:35:56 -05:00
Mike Frysinger e697147788 revert unneeded test change in previous commit
GH does not make it easy to edit PRs.
2021-03-03 02:19:32 -05:00
az6667 fc38677e80
Allow GIFs missing both Global and Local Colormaps to still decode (#494)
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
2021-03-03 02:17:51 -05:00
Martin Reboredo 39c4644fa0
HEIF support through libheif (#670)
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.
2021-03-02 12:32:03 -05:00
Mike Frysinger c75db8d082 scripts: clean up various shellcheck warnings
Should hopefully not break anything :).
2021-02-08 18:10:51 -05:00
wilson chen bc658270f5
tests/gdimageline/gdimageline_bug5: add im null judgement (#624)
gdImageCreate returns NULL in gdimageline_bug5.c on AIX, which make the judgement necessary in case of segment fault.
2020-05-20 19:29:23 +08:00
Christoph M. Becker 3dd0e308cb
Fix #615: gdImageStringFT() fails for empty strings as of libgd 2.3.0 (#633)
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`.
2020-05-05 18:02:45 +08:00
wilson chen ec0b439769
Improve test cases for gdImageString16 and gdImageStringUp16 (#625)
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.
2020-04-15 00:25:01 +08:00
wilson chen 1860547cf0
Fixed test case build configure error in issue #626 2020-04-13 15:09:51 +08:00
wilson chen b6b6e69363
tests/gdtest/CMakeLists.txt: include readdir.c under win (#520)
@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
2020-04-01 23:22:21 +08:00
wilson chen aa90da2db1
Fix two build configure errors in tests (#616)
tests/webp/bug_double_free should depend on webp and jpeg.
tests/gdimagesquaretocircle should depend on png.
2020-03-28 22:29:35 +08:00
wilson chen 3f50ffaefd
Fixed #596: gdTransformAffineCopy run error
And add test case for it.
2020-03-21 15:31:40 +08:00
wilson chen 08238a0ac2 Fix some memory leakage in test cases
Fix the memory leakage in following test cases: tests/bug_overflow_lagre_new_size.c, tests/gdimagecrop/bug00486.c, tests/bmp/bug00450.c
2020-03-21 10:59:33 +08:00
wilson chen a48dbca620
tests/gif/bug00006.c: fix memory leakage 2020-03-17 23:19:30 +08:00
wilson chen aa21ec9a61
add testcase for gdimagesquaretocircle() 2020-03-08 19:57:34 +08:00
wilson chen cc02e8878d
Add testcase for gdimagecompare() 2020-03-07 23:17:40 +08:00
wilson chen ef952d4ca5
add testcase for gdimagecreatefromgd2part 2020-02-26 23:52:52 +08:00
wilson chen 04bb9a08b3
Fix #301: brect bounds
According to the result, the extra one pixel is unnessary. Deleting the related code block makes
the image looks fine.
2020-02-25 23:40:27 +08:00
wilson chen ace7fd88dc
Fixed #169: update var type to hold bigger w&h for ellipse (#565)
Update var type to hold bigger w&h for ellipse. And add corresponding test cases.
2020-02-09 22:13:26 +08:00
wilson chen 6271c38065
add testcase gdImageCopyResized 2020-01-23 16:59:35 +08:00
Christoph M. Becker a9e66268f9 Fix #586: gdTransformAffineCopy() segfaults on palette images
We have to properly distinguish between truecolor and palette images.
2020-01-05 00:21:08 +01:00
Christoph M. Becker 9088591eae Fix #585: gdTransformAffineCopy() changes interpolation method
We have to properly initialize `interpolation_id_bak`.
2020-01-04 23:43:47 +01:00
Christoph M. Becker a59ee51e8d Remove trailing whitespace 2020-01-04 23:09:39 +01:00
Christoph M. Becker 6d21d30429 Fix #584: gdImageSetInterpolationMethod(im, GD_DEFAULT) inconsistent
We have to avoid the unintended fall through.
2020-01-04 19:06:51 +01:00
Christoph M. Becker 7a06c1669c Fix #583: gdTransformAffineCopy() may use unitialized values
We have to check the return value of `gdAffineInvert()`, and on failure
let `gdTransformAffineCopy()` fail as well.
2020-01-04 19:06:51 +01:00
wilson chen c8438b3b72 add testcase for gdImageWebpEx 2020-01-04 23:31:41 +08:00
wilson chen b1151dedb1
tests: Correct some test depend errors 2020-01-02 20:27:29 +08:00
wilson chen 8321d47931
add testcase for gdimagecreatefromgd2partptr 2019-12-24 23:07:43 +08:00
Fábio Cabral Pacheco a93eac0e84 Fix potential NULL pointer dereference in gdImageClone() 2019-12-20 17:19:54 +01:00
wilson chen 2e886046f8
Fix #497: gdImageColorMatch Out Of Bounds Write on Heap (CVE-2019-6977)
Fixed CVE-2019-6977 and add corresponding testcase.

Original patch by Christoph M. Bechker <cmbecker69@gmx.de>
https://gist.github.com/cmb69/1f36d285eb297ed326f5c821d7aafced
2019-12-20 10:12:04 +08:00
willson-chen 4b0f372402 Fixed #369: fix new_a init error in gdImageConvolution() 2019-12-13 10:54:25 +01:00
willson-chen b9004db6a2 add testcase for gdImageColorClosestHWB
add testcase for gdImageColorClosestHWB
2019-11-28 13:28:41 -05:00
willson-chen b5a5d98209 add testcase for gdImageColorMatch
add testcase for gdImageColorMatch
2019-11-28 13:27:29 -05:00
wilson chen c3a77b5a3b add testcase for gdimagestringup 2019-11-28 11:23:51 -05:00
wilson chen fac913b874 add testcase for gdImageStringUp16 2019-11-28 00:05:23 -05:00
wilson chen 05ae40a4ba add testcase for gdImageString16 2019-11-28 00:04:50 -05:00
wilson chen 39facb195f add testcase for gdImageCopyMergeGray 2019-11-28 00:04:08 -05:00
wilson chen c6880dc209 add testcase for gdimagestring 2019-11-27 13:46:38 -05:00