Commit Graph

29 Commits (master)

Author SHA1 Message Date
Pierre Joye 09d5a6ad83 partial #818, fix again that logic. I need to find something more generic and convenient to handle errors, assert and free used resources on fail assert 2022-02-01 22:58:21 +07:00
Pierre Joye 95c6185b37
Bug/818 (#821)
* Partial #818, unused arg

* Partial #818, init var

* partail #818, fix va_args usage

* partail #818, handle f* calls and avoid possible call to malloc with negative values

* partail #818, prevent double free

* partail #818, resource leak if test fail

* partail #818, null deref fix

* partail #818, avoid double free on fp failure

* Partial #818, fix error msg

* Partial #818, leak on error

* Partial #818, null deref

* Partial #818, avoid possible negative index on failure

* partial #818, does not free if we return if requested new size overflow

* partial #818, avoid double free, free where the alloc happened

* partial #818, fix assert logic and test exp_size for <=0

* partial #818, fix assert logic for color idx test

* partial #818, new case for possible leak, improve logic

* partial #818, fix assert logic for color idx test
2022-02-01 22:25:03 +07:00
Pierre Joye 910924ffd7
Bug/818 (#820)
* Partial #818, unused arg

* Partial #818, init var

* partail #818, fix va_args usage

* partail #818, handle f* calls and avoid possible call to malloc with negative values

* partail #818, prevent double free

* partail #818, resource leak if test fail

* partail #818, null deref fix

* partail #818, avoid double free on fp failure

* Partial #818, fix error msg

* Partial #818, leak on error

* Partial #818, null deref

* Partial #818, avoid possible negative index on failure

* partial #818, does not free if we return if requested new size overflow

* partial #818, avoid double free, free where the alloc happened

* partial #818, fix assert logic and test exp_size for <=0

* partial #818, fix assert logic for color idx test
2022-02-01 17:37:49 +07:00
Pierre Joye 167ea1f4f0
Fix tests based on coverity reports (#819)
* Partial #818, unused arg

* Partial #818, init var

* partail #818, fix va_args usage

* partail #818, handle f* calls and avoid possible call to malloc with negative values

* partail #818, prevent double free

* partail #818, resource leak if test fail

* partail #818, null deref fix

* partail #818, avoid double free on fp failure

* Partial #818, fix error msg

* Partial #818, leak on error

* Partial #818, null deref

* Partial #818, avoid possible negative index on failure

* partial #818, does not free if we return if requested new size overflow

* partial #818, avoid double free, free where the alloc happened
2022-02-01 15:09:01 +07:00
Mike Frysinger aac77143dd convert all files to native line encodings
A bunch of these files were committed with Windows line encodings.
Strip all those ^M gremlins out as people working on Windows can
use git's autocrlf setting to convert back and forth as needed.
2018-06-21 21:44:54 -04:00
Mike Frysinger 00bbb69cc3 tests: add more checks for libpng (and other deps)
This fixes #382.
2017-02-23 17:31:41 -05:00
Christoph M. Becker b4d153ba96 Fix and reenable optimized support for reading 1 bps TIFFs
Due to #82 the optimized support for reading 1 bps TIFF files (black &
white) had been disabled. Tony Lew already pointed out a fix in #88.

Furthermore, there was the following missing and improper error handling:
* TIFFReadScanline() returns -1 on error, not 0
* the result of TIFFReadTile() hasn't been checked
* in case of failure of these functions, the error had not been
  propagated

We fix this, and re-enable direct support for 1 bps TIFFs, which is
more memory efficient than the general RGBA support. We also make sure
not to hit any not yet implemented code path.
2017-01-25 23:28:23 +01:00
Christoph M. Becker be5a6457a8 Enable libtiff support on Windows 2017-01-25 12:58:28 +01:00
Christoph M. Becker 4859d69e07 Fix invalid read in gdImageCreateFromTiffPtr()
tiff_invalid_read.tiff is corrupt, and causes an invalid read in
gdImageCreateFromTiffPtr(), but not in gdImageCreateFromTiff(). The culprit
is dynamicGetbuf(), which doesn't check for out-of-bound reads. In this case,
dynamicGetbuf() is called with a negative dp->pos, but also positive buffer
overflows have to be handled, in which case 0 has to be returned (cf. commit
75e29a9).

Fixing dynamicGetbuf() exhibits that the corrupt TIFF would still create
the image, because the return value of TIFFReadRGBAImage() is not checked.
We do that, and let createFromTiffRgba() fail if TIFFReadRGBAImage() fails.

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

CVE-2016-6911
2016-12-13 13:55:48 +01:00
Mike Frysinger ae2eea3de3 tests: add missing newlines to error messages 2016-07-21 20:52:06 +05:30
Pierre Joye 61417d6854 Merge branch 'master' of github.com:libgd/libgd 2016-07-17 15:50:58 +07:00
Pierre Joye 2513936c3d win32 build fixes, skip or fix build 2016-07-17 15:48:43 +07:00
Christoph M. Becker 763cd194da No need to skip this test assertion, because libgd supports only lossless TIFF 2016-07-15 17:42:25 +02:00
Christoph M. Becker e210ff1149 Partially implement #220: tests: replace all printf error messages with gdTestErrorMsg 2016-07-15 14:59:21 +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
Matt Bosworth 4e53ed7992 Added support for reading and writing TIFFTAG_XRESOLUTION and
TIFFTAG_YRESOLUTION.  Includes a unit test.
2016-01-22 12:52:50 -08:00
Nathanael Jones b52b9c5579 Upgrade to long-syntax CMAKE add_test command to improve cross-platform compatibility. 2015-01-07 01:39:10 -05:00
Ondřej Surý ac6222f945 Merge outstanding autotools changes 2013-04-08 09:12:06 +02:00
pierrejoye e20413bf6b - apply same CS everywhere 2013-04-03 14:23:11 +02:00
Takeshi Abe 804e369b49 search GD headers locally at first
at least for gcc's cpp: http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
2013-03-01 16:53:11 +09:00
Takeshi Abe 63da42ea82 GDTESTS_TARGET_LINK is just gdTest 2013-02-22 11:20:30 +09:00
tabe 53d6320309 fixed possible segfaults when gdNewDynamicCtx() returns null 2009-06-25 19:05:45 +00:00
tabe e27c3c7f2c fix for FS#204
* gdImageCreateFrom*() returns null if null pointer given
* gdImage*() puts nothing if null pointer given
2009-06-18 13:35:26 +00:00