Commit Graph

23 Commits (6013c7bcf6eb795dba584f92d3824ebd3ae60202)

Author SHA1 Message Date
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
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 c8438b3b72 add testcase for gdImageWebpEx 2020-01-04 23:31:41 +08:00
Christoph M. Becker a49feeae76 Fix double-free in gdImageWebPtr()
The issue is that gdImageWebpCtx() (which is called by gdImageWebpPtr() and
the other WebP output functions to do the real work) does not return whether
it succeeded or failed, so this is not checked in gdImageWebpPtr() and the
function wrongly assumes everything is okay, which is not, in this case,
because there is a size limitation for WebP, namely that the width and
height must by less than 16383.

We can't change the signature of gdImageWebpCtx() for API compatibility
reasons, so we introduce the static helper _gdImageWebpCtx() which returns
success respective failure, so gdImageWebpPtr() and gdImageWebpPtrEx() can
check the return value. We leave it solely to libwebp for now to report
warnings regarding the failing write.

This issue had been reported by Ibrahim El-Sayed to security@libgd.org.

CVE-2016-6912
2016-12-13 14:40:03 +01:00
Christoph M. Becker 1458f8765c Support writing lossless WebP
Lossless WebP is a rather interesting alternative to PNG, and already
supported by `gdImageCreateFromWebp*()`, so we add support for
`gdImageWebp*()`, too.

We can stick with the existing API, using the quality parameter to
request lossless encoding if it is set to `gdWebpLossless`, which we
define to `PHP_INT` (to avoid adding a new dependency to gd.h, we hard-
code the value – we're assuming `sizeof(int)==4` anyway).
2016-10-09 00:47:05 +02:00
Christoph M. Becker cfd50c61bb Revert "Add a basic test for gdImageCreateFromWebp()"
This reverts commit f14192d70f.
2016-10-08 17:10:44 +02:00
Christoph M. Becker 9b9fdbfee5 Fix broken test
The test of the lossy image fails on Travis, what is a clear signal that
it could fail elsewhere as well. Therefore we allow up to 1% of the pixels
to be different from the expected result.
2016-10-08 16:46:29 +02:00
Christoph M. Becker f14192d70f Add a basic test for gdImageCreateFromWebp()
We're testing a lossless and a lossy Webp with alpha channel. The images
have been taken from <https://developers.google.com/speed/webp/gallery2>,
have been authored by Fizyplankton and are in the public domain.

The lossy test might fail for another libwebp version, so it appears to
be best to not cherry-pick into GD-2.2 yet.
2016-10-08 16:07:06 +02:00
Pierre Joye 61417d6854 Merge branch 'master' of github.com:libgd/libgd 2016-07-17 15:50:58 +07:00
Pierre Joye 5e42d30d5a fix windows build 2016-07-17 15:50:47 +07:00
Christoph M. Becker 284bbdd85f Remove useless SVN Ids 2016-07-15 16:34:47 +02:00
Mike Frysinger 3bb6aac422 tests: cmake: switch to list appending
This makes it a bit cleaner when dealing with optional tests as we
use the LIST(APPEND...) command everywhere instead of sometimes SET
and sometimes LIST.
2016-06-15 15:02:13 -04:00
Mike Frysinger cad672775d tests: cmake: move feature tests to subdirs
This makes it better match the autotools which makes it easier to
compare, and allows finer grain checks (since some subtests need
more than one feature test).

As an example, this makes it clear we were missing gdinterpolatedscale.
2016-06-15 14:53:42 -04:00
Mike Frysinger 10a4915114 tests: rework handling of temp output files
Many of the tests open files in local paths for writing which leaves a
variety of temp files in the tests subdirs.  This ends up failing in a
few scenarios like out of tree builds or cmake builds.

Add a few helper functions to the common gdtest module to quickly get
handles to temp files for the tests to leverage.
2016-05-17 23:32:16 -04:00
Mike Frysinger 0315e441ec tests: gd2: add general read test helpers #208
Since we have random files we want to read & check, turn the two
read programs into general tools.  Then we have shell scripts to
run against the right inputs.

Most of the changes here are just shuffling variable names so we
can add to check_PROGRAMS independently of TESTS.
2016-04-30 21:52:45 -04:00
Mike Frysinger 613e8c93e3 tests: split up makefile entries
This matches what we've done with cmake files, and it makes managing
the subdirs much easier.
2016-04-30 21:02:45 -04:00
Mike Frysinger adc8598dcb tests: unify cmake test code into a single macro
This makes the test code a lot easier to manage rather than copying &
pasting the same boiler plate multiple times.

Also take the opportunity to add a common prefix to each test name so
we don't get collisions between subdirs if a test happens to use the
same exact name.
2016-04-30 21:02:45 -04:00
Mike Frysinger 4c6a07b263 gitignore: split up test entries
This makes it easier to keep track of things.  The single toplevel list
can make it hard to notice when something is stale.
2016-04-30 13:56:19 -04:00
Mike Frysinger 1c33d94c9f tests: fix header inclusion
gdnametest uses string funcs, so pull in string.h.  It also can't pull
in test_config.h directly as it breaks when building out of tree.  Use
the -I paths to find it.

bug00111 uses unlink(), so pull in unistd.h

URL: https://bugs.gentoo.org/540376
2015-02-28 17:25:49 -05:00
Pierre Joye a79232c5fa fix #129, drop VPX usage in favor of libwebp 2015-01-20 04:55:11 +01:00
Pierre Joye b1f431372b add tests for #111 2015-01-17 08:27:46 +01:00