Commit Graph

15 Commits

Author SHA1 Message Date
Jacob Boerema b6d5707816 plug-ins: fix possible overflow in computation
FLI/FLC width x height is 16-bit unsigned, so theoretically it could
overflow a 32-bit signed int.
We fix this by making it a 64-bit signed int.
2022-06-03 12:52:17 -04:00
Jacob Boerema 980e604880 plug-ins: fix reading of FLI files where the filesize is off-by-on 2022-05-16 11:22:14 -04:00
Jacob Boerema ca8eee1755 plug-ins: improve error handling of FLI export
Added GError parameters to all static file write functions, check for
failed writing and return an error if that is the case.

Additionally, at end of file make sure the last dummy byte is written to
make chunks an even size.
2022-05-16 11:22:14 -04:00
Jacob Boerema 7a2dd01a3a plug-ins: fix wrong return types forgotten in previous commit 2022-05-11 18:37:55 -04:00
Jacob Boerema dd7c067715 plug-ins: further improvements in error handling in FLI/FLC loading
- Changed all static read functions to have a GError parameter, use a
  parameter for the value read, and return a gboolean that will be FALSE
  when reading from file failed.
- Check the return values of all read functions and set GError when
  needed.
- Added more error checking, like comparing real filesize with what the
  header tells us, check for valid speed and number of frames.
- Added some gdebug statements for easier debugging.
- Don't assume that all FLI/FLC writers followed the specs and wrote an
  even number of bytes per chunk.
- Skip "frames" that do not have the FRAME type (in most cases this is
  a PREFIX chunk).
2022-05-11 16:28:58 -04:00
Jacob Boerema 317e0ca21e plug-ins: update public FLI functions to add a GError and return gboolean
Improvements to the FLI loading and exporting plug-in:
- I added a GError parameter to all public read/write functions.
- All public functions now return a gboolean result to show if they
succeeded or failed. Before most functions were void. For the non void
returns (the two fli_write_color functions) I added a gboolean
parameter.
- Do cleanup if we fail to read a frame. If at least one frame was read
successfully, we will keep the incomplete image/animation.
- Change name of layer to include the delay in ms.
2022-05-11 16:28:58 -04:00
Jacob Boerema 5ecf46ccef plug-ins: cleanup of fli plug-in, use glib types and change ulong to guint32
The unsigned long type in this plug-in is always used for reading/writing
32-bit unsigned integers, so let's change it to guin32 to not get
confused.
Changed unsigned short to gushort, unsigned char to guchar.
2022-05-07 14:19:30 -04:00
Rafał Mikrut 3e35fe4d80 Cppcheck fixes 2020-11-05 19:42:14 +00:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Jehan 375b767928 plug-ins: clean-up coding style of fli plug-in code.
There should be absolutely no code change semantic in this commit. If
there is, that's a mistake and it's on me. I only cleaned up the syntax
in the C file which basically was following none of GIMP coding style
(tabs everywhere, brackets at end of lines, nearly no space anywhere so
all the code was a compressed mess which was hard to read, indentation
absolutely wrong everywhere, etc.).
I cleaned it up with a bunch of regexp search-and-replace followed by a
lot of manual cleaning and verification as well.

I also tested with various FLI files found on the web, and they were
loading fine in GIMP. So I believe/hope that I didn't mess up somewhere,
but it looks as the cleaning went all fine.
2017-12-22 16:00:34 +01:00
Tobias Stoeckmann edb251a7ef Bug 739133 - (CVE-2017-17785) Heap overflow while parsing FLI files.
It is possible to trigger a heap overflow while parsing FLI files. The
RLE decoder is vulnerable to out of boundary writes due to lack of
boundary checks.

The variable "framebuf" points to a memory area which was allocated
with fli_header->width * fli_header->height bytes. The RLE decoder
therefore must never write beyond that limit.

If an illegal frame is detected, the parser won't stop, which means
that the next valid sequence is properly parsed again. This should
allow GIMP to parse FLI files as good as possible even if they are
broken by an attacker or by accident.

While at it, I changed the variable xc to be of type size_t, because
the multiplication of width and height could overflow a 16 bit type.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2017-12-22 13:32:21 +01:00
Richard Kreckel dd9b0fc55b Bug 768044 - Fix many typos
This fixes many typos in comments and one in a user-visible string (msgid
"center abscisse" changed to "center abscissa" in affected po files. too).
2016-06-26 00:35:24 +02:00
Michael Natterer fe19ad9706 Bug 683694 - Spelling errors
Reworded all places that used to say "allows to".
2012-11-11 15:50:25 +01:00
Michael Natterer d9b5207aa2 Change licence to GPLv3 (and to LGPLv3 for libgimp).
2009-01-17  Michael Natterer  <mitch@gimp.org>

	* all files with a GPL header and all COPYING files:

	Change licence to GPLv3 (and to LGPLv3 for libgimp).

	Cleaned up some copyright headers and regenerated the parsers in
	the ImageMap plugin.


svn path=/trunk/; revision=27913
2009-01-17 22:28:01 +00:00
Michael Natterer 3d75c95f95 plug-ins/bmp/* plug-ins/faxg3/* plug-ins/fits/* plug-ins/fli/*
2008-08-11  Michael Natterer  <mitch@gimp.org>

	* plug-ins/bmp/*
	* plug-ins/faxg3/*
	* plug-ins/fits/*
	* plug-ins/fli/*
	* plug-ins/ico/*
	* plug-ins/jpeg/*
	* plug-ins/psd/*
	* plug-ins/sgi/*
	* plug-ins/uri/*
	* plug-ins/xjt/*: removed these...

	* plug-ins/file-bmp/*
	* plug-ins/file-faxg3/*
	* plug-ins/file-fits/*
	* plug-ins/file-fli/*
	* plug-ins/file-ico/*
	* plug-ins/file-jpeg/*
	* plug-ins/file-psd/*
	* plug-ins/file-sgi/*
	* plug-ins/file-uri/*
	* plug-ins/file-xjt/*: and moved them here. Changed executable
	names to "file-foo".

	* plug-ins/Makefile.am: changed accordingly.

	* plug-ins/common/*: rename all file plug-ins to file-foo.c. Get
	rid of the names "poppler" and "postscript" and call them
	"file-pdf" and "file-ps" because the conflict with standard
	autofoo targets is gone.

	* plug-ins/common/plugin-defs.pl: changed accordingly.

	* plug-ins/common/mkgen.pl: make sure cflags variables are named
	"PLUG_IN_NAME_CFLAGS" and not "PLUG-IN-NAME_CFLAGS"

	* plug-ins/common/Makefile.am: regenerated.

	* configure.in: change folders and variable names to match above
	changes.


svn path=/trunk/; revision=26494
2008-08-11 10:06:13 +00:00