Commit Graph

66 Commits (master)

Author SHA1 Message Date
Brett 5c8d8d1159
enable interlace transform when reading png (#823) 2022-02-07 12:57:24 +07:00
Pierre Joye 0956816bc6
#797 possible leak on png error, returns from setjmp lost the row_poi… (#802)
* #797 possible leak on png error, returns from setjmp lost the row_pointers ref somehow

* skip that one using mingw until we have a reliable portable FP related tests suites (may never happpen)
2022-01-23 11:57:49 +07:00
woho 636100b928 Catch libpng warnings (#295) 2021-10-21 12:02:29 -04:00
Pierre Joye 2d7db2d7fa silent fall trhough warning, that comment is read by gcc 2021-08-17 10:46:07 +07:00
Pierre Joye 98c6a27429 silent warning/unused args when codecs not enabled 2021-08-16 17:03:52 +07:00
Mike Frysinger a91cb62f01 add stub ABI funcs when formats are disabled #345
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.
2019-02-09 13:16:57 -05:00
Peter Kokot 01c59d840b Remove Git ident attributes
Git ident attributes were in most cases utilized with SVN and keywords
substitutions, where $Id$ were replaced with certain revision from the
repository. In Git this functionality is different. Each $Id$ needs to
be defined in .gitattributes file to be effective. This patch removes
unused and outdated attributes.
2018-06-27 02:04:37 +02:00
Mike Frysinger fd06f7f83c clean up trailing whitespace/newlines
This is preparation for adding some linting checks for new commits from
people.  Shouldn't be any functional changes here (tests still pass!).
2018-06-21 22:47:42 -04:00
Mike Frysinger 98b3f04b21 png: fix memory leak with error handlers in outputs
If the png error handle is triggered during output, the allocated
rows aren't freed.  Change the allocation to calloc to zero out all
the rows, and then walk them in the jump callback to release them.
2018-06-21 21:18:08 -04:00
Christoph M. Becker 3b8a69cfe5 Merge branch 'pull-request/346' 2017-08-27 17:45:20 +02:00
Christoph M. Becker 2207e3c88a Fix #381: libgd double-free vulnerability
The issue is that `gdImagePngCtxEx` (which is called by `gdImagePngPtr`
and the other PNG output functions to do the real work) does not return
whether it succeeded or failed, so this is not checked in
`gdImagePngPtr` and the function wrongly assumes everything is okay,
which is not, in this case, because the palette image contains no
palette entries.

We can't change the signature of `gdImagePngCtxEx` for API
compatibility reasons, so we introduce the static helper
`_gdImagePngCtxEx` which returns success respective failure, so
`gdImagePngPtr` and `gdImagePngPtrEx` can check the return value. We
leave it solely to libpng for now to report warnings regarding the
failing write.

CVE-2017-6362
2017-08-27 17:18:34 +02:00
Christoph M. Becker fea55903ee Fix #338: Fatal and normal libjpeg/ibpng errors not distinguishable
libgd clients need to be able to distinguish between fatal and
"extremely fatal" libjpeg and libpng errors, because in the former case
execution can proceed, but in the latter case libgd calls exit().
Therefore we report fatal errors as GD_WARNING.
2016-11-16 18:10:29 +01:00
Christoph M. Becker c1804def24 Mark up code examples with (start|end code)
This makes the code better readable in the sources, and we get syntax
highlighting in the generated HTML wherever we want it (i.e. not necessarily
always as with `-hl all`).
2016-08-23 22:27:27 +02:00
Christoph M. Becker 9a3bd7077e Group the supported image formats in the menu of the docs
To do so we have to add Menu.txt to the project, but we can ignore
Languages.txt and Topics.txt, at least for now.
2016-08-14 16:11:05 +02:00
Pierre Joye 2b7c36d074 fix coverity CID 95841, should not happen but in case libpng adds special cases we will be covered here. 2016-06-20 09:19:17 +07:00
Mike Frysinger e5306635ff png: fix some memory leaks w/invalid images
The use of setjmp in this function was slightly incorrect: we store
pointers to allocated memory in stack variables, but we didn't call
setjmp again afterwards.  Optimization might place those in registers
which would clobber their values on the next longjmp.  Make sure we
call setjmp after every allocation to update the state.

As part of the cleanup, unify all the error code paths so we don't
have to worry about every if statement being fully correct.
2016-05-14 02:44:31 -04:00
Pierre Joye 490bc3e0b9 free palette on error 2015-01-19 04:10:46 +01:00
Pierre Joye 13d87a623e free im on error 2015-01-14 02:09:30 +01:00
Pierre Joye 5f7c099fc8 free allocated palette on error 2015-01-07 06:27:11 +01:00
Pierre Joye 7b4986279a fix im leaked on error 2015-01-07 06:17:51 +01:00
Pierre Joye 4faf926d3f just reduce static analyzer noise 2015-01-07 06:13:53 +01:00
Chris Reuter 275ac17bcc Started importing the old manual into Naturaldocs comments.
This changeset imports documention for gdImage to gdImagePng*() into
Natural Docs.  Documention is based on the text of the original
manual, version 2.0.36 but adapted to better suit the format.
Subsequent changesets will introduce docs for subsequent manual
entries.

naturaldocs, when present, is invoked by bootstrap.sh.  The completed
manual will be in docs/naturaldocs/html/index.html.  It can also be
explicitly invoked by running docs/naturaldocs/run_docs.sh.

This change also removed docs/naturaldocs/project/Menu.txt, since it
currently contains no non-generated content and is prone to introduce
noise into the changeset.
2014-01-07 15:29:06 -05:00
Ondřej Surý 17ce9be0e8 Fail on unknown PNG color_type instead of using initialized memory blocks (num_colors) 2013-05-22 13:09:42 +02:00
Ondřej Surý d93e499263 Improve gd_error -> gd_error_ex usage 2013-04-22 15:11:24 +02:00
Takeshi Abe 8843ac583a avoid warning: implicit declaration of function ‘gd_error’ [-Wimplicit-function-declaration] 2013-04-20 08:18:20 +09:00
Ondřej Surý 32b1307c62 Use custom error handler instead of fprintf(stderr, ...) 2013-04-18 08:28:36 +02:00
pierrejoye e20413bf6b - apply same CS everywhere 2013-04-03 14:23:11 +02:00
Takeshi Abe 7382faef3c fix -Wsign-compare 2013-02-15 15:39:38 +09:00
tabe 3aaf1ab557 fix -Wunused-parameter 2013-02-11 11:31:40 +09:00
tabe 19d0de25d7 fix FS#235 2010-12-04 11:46:41 +09:00
tabe 5498dacd03 fix URL 2010-11-20 00:25:21 +09:00
tabe 1ad34e9c8c use png_sig_cmp to support libpng 1.4, old is deprecated already in older version 2010-01-13 17:48:23 +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
tabe a44ea09fc9 replaced static gdPngJmpbufStruct, which is afraid of being shared with
several threads, by a couple of auto variables.
2009-03-31 16:17:23 +00:00
tabe ba9e574a5d append a line feed 2009-03-14 04:57:31 +00:00
tabe c719401fcd fixed a slim chance of memory leaks. 2009-03-14 04:16:49 +00:00
tabe 1f3a89eed9 fixed FS#193 2009-03-13 20:18:24 +00:00
tabe c8cf1a3980 ref FS#176: surround with #ifdef PNG_pHYs_SUPPORTED. 2009-03-13 15:50:38 +00:00
tabe f40454c1b3 ref FS#176: added support of variable resolution by Alan Boudreault. 2009-03-08 09:16:04 +00:00
pajoye 191ef86832 - #88, MFB: Bug loading png images in grayscale + alpha
- add test
2007-11-18 14:46:45 +00:00
pajoye d5e41b333c - WS / CS 2007-11-17 21:44:37 +00:00
mattias d93586b409 - #105, gdImageCreateFrom*Ptr() can crash if gdNewDynamicCtxEx() fails 2007-08-07 19:44:40 +00:00
pajoye 68559130d7 - MFB: #86, Possible infinite loop in libgd/gd_png.c 2007-05-17 14:49:45 +00:00
pajoye ea7c2cdc12 - MFB: #67, Preferable calls of gdFree() in libgd
(tabe at fixedpoint dot jp)
2007-05-06 18:46:45 +00:00
pajoye 1e2962e663 - #32, malformed PNG image crashes (CRC error)
test is following
2007-01-07 18:18:06 +00:00
pajoye bba046b3a2 - #12, initialize the sig buf not infile, good that we don't use getC... 2006-11-05 15:01:47 +00:00
pajoye cc3eb67695 - #11, gdImageCreateFromPng* possible crash with empty file
Thanks to Antony Dovgal to have catched this bug
2006-10-11 00:02:16 +00:00
pierre 5742a4107e - sync to 2.0.29 2006-04-05 15:54:20 +00:00
pierre 17619804d6 - sync to 2.0.24 2006-04-05 15:52:22 +00:00