Commit Graph

7850 Commits

Author SHA1 Message Date
Jehan c548d5d342 Bug 792657 - A useless error message when cancelling opening a .svgz.
Use the new gimp_get_pdb_status() to forward the error returned by
gimp_file_load(). Previous code was always returning
GIMP_PDB_EXECUTION_ERROR when the file load was failing, but this was
not granular enough. In particular when the file load is actually
interactively cancelled through Esc or the "Cancel" button, we don't
want to display an error message on screen. Therefore we forward the
actual error raised by the underlining plug-in.
2018-01-19 14:20:40 +01:00
Jehan 911e46ee2b plug-ins: indentation fix.
So minor! But while I was reading this code, I just couldn't just leave
this one indentation unfixed. ;P
2018-01-19 14:04:47 +01:00
Massimo Valentini cb78618d75 Bug 783703: no progress bar changes when exporting to psd format 2018-01-14 23:28:12 +01:00
Jehan 4849d41060 plug-ins: check pointer before freeing.
Thanks to Massimo for notifying about it.
2018-01-14 00:56:40 +01:00
Jehan dcd4e46441 plug-ins: implement RGBE exporting through GEGL.
While we are at it, let's just add RGBE exporting. It's just as easy.

Also rename s/file-gegl-load-rgbe/file-load-rgbe/. All formats just use
the "file-FORMAT-(load|save)" naming for their procedure, even when
implemented directly through "gegl:load|save".
2018-01-13 01:27:01 +01:00
Jehan 3cca5a0a7b plug-ins: use only "#?" for RGBE magic number.
It seems that various software use something different after the "#?",
and even Blender code just ended up only use these 2 characters as magic
number. See also bug 792453.
2018-01-13 00:42:06 +01:00
Massimo Valentini 9799032e4f Bug 792453: Extend the raw data import plugin to open...
... .hdr files (RGBE images)

Expose in GIMP GEGL RGBE file support
2018-01-12 22:00:11 +01:00
Massimo Valentini 5db03953c0 Bug 785138: .GIH brushes and reference displacement...
...when them have layers with different sizes

properly center smaller brushes loading gih files
and always NUL terminate brushes name
2018-01-12 00:49:59 +01:00
Jehan 82f6baf2bb plug-ins: file export should follow preferences regarding metadata.
Various plug-ins exporting metadata should now follow preferences, which
would override any default. Of course these preferences can still be
overriden by saved settings (global parasite), previous run settings,
and finally through the GUI when interactive.
2018-01-11 22:17:32 +01:00
Jehan 096debb0fd Bug 790552 - do not save metadata by default.
This is a privacy concern. Whereas importing metadata is usually a good
idea, exporting it should be a conscious action. A lot of private data
can be leaked through metadata and many people don't realize it (which
also usually means they don't need it). On the other hand, the people
who realize it are the ones who would explicitly edit the metadata and
check what they want to be exported or not.

This is only a first step. Some people may want to always export the
metadata and for these people, there should be abilities to change the
default.
2018-01-11 00:39:22 +01:00
Jehan bc5032012e plug-ins: fix some coding-style issues in metadata-editor.
Mostly missing spaces here and there fixed with search and replace
followed by manual verification and retouching.
2018-01-10 03:32:33 +01:00
Jehan 62ee5d3c7e plug-ins: metadata-editor crashes when strtok() initialized with NULL.
When running strtok() the first time, it needs to be non-NULL so we must
check for the string. This is even more important because NULL actually
has a special meaning in strtok() to indicate further search on the same
string, in a stateful way. So searching with NULL at first call was
crashing the metadata editor plug-in in my case.
I could also imagine it could have reused strings from previous
searches, mixing metadata contents in some edge cases. Anyway that would
be bad as well!

While I was there, I also checked for non-null search string before
strstr() calls, when there was not already such a check before. This
function also requires non-NULL haystack argument.
It feels like this code doesn't do much validity checks, and it's likely
there are more similar issues. I haven't reviewed the whole code, only
this part which was crashing here.
2018-01-10 03:25:24 +01:00
Jehan 657c39dc74 plug-ins, themes: use the "normal text" color as stdout color of...
... the python console.
It was using "selected text", which is most often inverted color (close
if not identical to the background color). As a consequence, it made
stdout output unreadable by default, forcing themes to always define a
style for the python console. Using "normal text" is a much better
choice to default to something readable from a parent style.

As a consequence, I also removed "python-fu-console" styling from the
System theme, where there should be as few theming as possible.
2018-01-09 18:41:59 +01:00
Massimo Valentini e663526de9 Bug 753736: GIMP Python green prompt is virtually...
... unreadable to those with certain type of color blindness
2018-01-09 17:44:37 +01:00
Michael Natterer 29fbeb9e02 plug-ins: "port" qbist to float (remove the uchar conversion from float code) 2018-01-08 21:50:20 +01:00
Michael Natterer f7fe2753e2 plug-ins: port qbist to GEGL, it's just too cool/weird to get lost 2018-01-08 02:45:54 +01:00
Michael Natterer c8e1703dce plug-ins: never edit common/Makefile.am directly
edit plugin-defs.pl and run ./mkgen.pl
2018-01-08 02:43:26 +01:00
Jehan 22a6e2bb19 plug-ins: update the warning message for dimension of X bitmap cursors.
After discussing with Mitch and understanding better the X bitmap/pixmap
history, I make the warning more specific to X bitmap cursors only (not
pixmap).
Also I can see our code always exports RGBA data, so I am not quite sure
if this warning even makes sense since X bitmaps are bicolor maps. On
the other hand, Mitch tells me that "these days gdk turns pixbufs into
bitmaps if the x server doesn't support rgba cursors", so maybe that can
still be of use to warn cursor designers for max compatibility.
Still that's pretty old compatibility stuff, so let's replace "may" by
"might".
2018-01-08 00:19:34 +01:00
Jehan 575013feaa plug-ins: fix a bit of coding styles (spaces and alignment). 2018-01-08 00:07:58 +01:00
Jehan df933c7b70 plug-ins: discard leading 0s in regular expression for cursor size/delay
Leading 0s have no special value, we use base 10 anyway. Removing
leading 0s allows to not trigger the 8-digit test, hence modify a valid
cursor size unecessarily.
2018-01-07 15:49:37 +01:00
Jehan 0484ce83af Bug 792266 - Increase maximum size of x11 cursor during export.
We were basing our max export size on a macro value defined in
libXCursor code: MAX_BITMAP_CURSOR_SIZE. This macro is still defined in
libXCursor and still has the same value (64), yet it is unsure how far
or even where this is enforced since it seems we can get at least 96px
cursors in GNOME/X11.

As a consequence, this commit:
- still warns when cursor size is over this value, with more explicit
  text, yet does not change the cursor size anymore! So it is now
  possible to export bigger cursors, but you still get a warning.
- only changes the cursor size for the existing more-than-8-digits test
  and I add a warning when it does so (we should never modify an image
  silently!).
- adds the size 96 as not triggering the warning about GNOME Settings
  since it definitely looks like this size is valid there (according to
  my own empirical tests). Also since 96 is higher than the libXCursor
  current MAX macro value, this really raises the question to where this
  max is enforced and whether we should not just drop the first warning.

Note that it breaks a bit the string freeze since I modify one string
and adds one. Sorry for this!
2018-01-07 15:16:28 +01:00
Massimo Valentini a5b2139ca3 Bug 765651: file-psd-load.exe crashes importing file
Rather skip extra layer masks than crash.
2018-01-06 12:44:28 +01:00
Massimo Valentini 7ccf5d2624 Bug 761140: importing gimpui module causes plugin query failure
After commit f51acf3bfb the python console no longer
initialized gimpui, because it is no longer part of module
initialization.

If the plug-in is run noninteractively and it imports
gimpui explicitely it is now necessary to call gimp_ui_init ()
at the right time
2018-01-06 12:12:16 +01:00
Michael Natterer 3b950f6177 plug-ins: some cleaup in file-raw, mostly formatting 2018-01-05 15:31:57 +01:00
Tobias Ellinghaus 313d8c2876
file-darktable: Add more debug prints 2018-01-05 14:21:59 +01:00
tcapix 6b4b8c95c7 Bug 792197 - inconsistent use of tabs and spaces in indentation
Turn tabs into spaces.
2018-01-04 13:25:26 +01:00
Michael Natterer abcf372d7f Bug 776994 - Gimp fails to open corrupted JPG image
Load as much of a broken/truncated JPEG as possible:

As soon as loading the scanlines has started, set a new setjmp()
location that doesn't abort loading alltogether but keeps the loaded
part of the image.
2018-01-01 22:37:30 +01:00
Tobias Stoeckmann 764056e124 Bug 789612 - Prevent heap overflow in GBR parser
It is possible to trigger a heap overflow with insanely large GBR
files with a deprecated file format on 32 bit systems.

The problem is that old versions of GBR allowed an additional pattern
after the brush data. These patterns have always 4 bytes per pixel,
but the initial size check is performed with the bytes per pixel of
the brush, which can be different.

If the brush has 1 byte per pixel and the dimensions are sufficiently
large, this can trigger a heap overflow with attacker-controlled
amount and content of data.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2018-01-01 17:15:38 +01:00
Massimo Valentini cd4a0a185c Bug 783336: exported openraster (.ora) missing...
...mergedimage.png

fix also the thumbnail creation, that:
must be 8 bit; should not be upscaled; should not have frame
or decoration, that I interpreted as when there are transparent
areas they should not be blended with a background color,
so instead of image_flatten use  image_merge_visible_layers
(also for the merged_image)
2018-01-01 16:00:30 +01:00
Alexis Wilhelm a51efd09d1 Bug 663576 - make -C plug-ins/script-fu check-for-deprecated-procedures-in-script-fu...
...lists files that do not use deprecated functions

Better regex that matches the right stuff.
2018-01-01 14:25:03 +01:00
Alexis Wilhelm 8b29687353 Bug 637413 - Saving indexed png with transparency removes one unused color from the colormap 2017-12-31 21:56:54 +01:00
Michael Natterer 8b68501622 plug-ins: set GimpColorConfig on some color buttons, more to do... 2017-12-31 13:57:41 +01:00
Massimo Valentini f658ea4071 Bug 777403 - Calling (file-png-get-defaults) crashes the file-png plug-in
commit 21bed1e2fb

moved the lines

+  run_mode = param[0].data.d_int32;
+

without considering the plug-in registers parameterless
procedures
2017-12-29 12:00:18 +01:00
Alexandre Prokoudine 9724d7989d Mark legacy plug-ins/scripts as such in menu 2017-12-27 02:40:27 +03:00
Jehan 34a6c6408e plug-ins: aaargh! Forgot to remove "paintbrush.pgm" from the Makefile.
My bad!
2017-12-26 19:52:19 +01:00
Jehan ccfec08a84 Bug 791934 - gimpressionist contains 2 identical brushes.
Delete "paintbrush.pgm" which is binary identical to "paintbrush01.pgm",
now that we have proper migration code for gimpressionist presets.
2017-12-26 17:48:08 +01:00
Øyvind Kolås 0a09452d17 plug-ins: fix my name/email in the goat exercise 2017-12-25 22:35:23 +01:00
Jehan 2d4715bee9 Bug 791901 - GeglBuffers leaked with Zealous Crop. 2017-12-24 00:39:02 +01:00
Jehan 317f7fa5ca Bug 791514 - Cannot export to webp file.
fopen() modes "wb+" and "w+b" are aliases of the same opening mode
(truncate/create in binary read/write). But it turns out that Windows
implementation does not understand "wb+". The alias "w+b" works fine in
my tests.
2017-12-22 19:25:11 +01:00
Jehan eb21819081 plug-ins: clean the rest of the file-fli plug-in.
While I am at it, let's just do all the files in there. Other also had a
bunch of tabs and wrong coding style.
2017-12-22 18:08:19 +01: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
Jehan ba759fbcfd Revert "Bug 790784 - (CVE-2017-17784) heap overread in gbr parser / load_image."
This reverts commit 06d24a79af.

The CVE is still fixed but now in a different way. Commit 4fa0cd4dcf
passes instead the accurate string length when using the string, hence
making it work even when not NUL-terminated. This has the advantage of
having the GBR file loaded in the end, despite such file format error. I
am personally not persuaded this is the best path since a file with such
an error may either be corrupted, or worse may have been constructed on
purpose to be harmful, so rejecting it directly may be the safe choice.
Nevertheless I may also be too doubtful and maybe trying to save a
slightly corrupted file may be the nicest choice indeed.
2017-12-21 22:14:39 +01:00
Tobias Stoeckmann 4fa0cd4dcf gbr/pat: Fix out of boundary read on illegal names
The file formats GBR and PAT contain names which are supposed to be
NUL-terminated within the files. If no such terminating NUL byte
exists, the parsers of GBR and PAT trigger an out of boundary read
during utf-8 conversion.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2017-12-21 22:09:54 +01:00
Jehan 5b9e277625 app, plug-ins: clean up previous commit by using g_error_set()...
... instead of g_message().
2017-12-21 21:55:04 +01:00
Massimo Valentini 657a754f98 Bug 789610: invalid gbr brush crashing GIMP 2017-12-21 21:50:09 +01:00
Jehan 877e79b935 plug-ins: properly propagate GError.
Some g_message() stay when they are used as debug or warning message
(without actually cancelling load action). But all fatal errors now use
g_set_error().
2017-12-21 21:47:25 +01:00
Jehan 037cc8586b plug-ins: use g_set_error() instead of g_message().
Also simplifies a bit the check for PSP version support.
2017-12-21 20:32:17 +01:00
Jehan eb2980683e Bug 790853 - (CVE-2017-17787) heap overread in psp importer.
As any external data, we have to check that strings being read at fixed
length are properly nul-terminated.
2017-12-21 12:49:41 +01:00
Jehan 06d24a79af Bug 790784 - (CVE-2017-17784) heap overread in gbr parser / load_image.
We were assuming the input name was well formed, hence was
nul-terminated. As any data coming from external input, this has to be
thorougly checked.
2017-12-21 12:15:34 +01:00