Commit Graph

3898 Commits

Author SHA1 Message Date
3d55452933 Bug 794152 - JPEG 2000 Code Stream .j2c support.
Current OpenJPEG code only supported the base JP2 container. It now
supports also the JPEG 2000 codestream (which is usually contained
inside other formats, like the JP2 container format, but can also
sometimes be on its own).
The current magics and extension strings were also mixing all kind of
formats. This is now cleaned up a bit.
2018-03-10 00:03:15 +01:00
00e828a3ef plug-ins: deduct color space from profile if not specified otherwise.
As explained in the previous commit, the color space is not always
properly declared, in particular with J2K files. If a profile is present
in such a case, try to deduct the color space from this information.
2018-03-09 22:12:23 +01:00
6f5c20eef1 plug-ins: assume RGB/RGBA for JPEG2000 without declared color space.
It seems that the color space is not necessarily declared for a JPEG2000
image. From tests, it looks like it especially happens with JPEG2000
codestream (.j2c or .j2k). This variant is apparently mostly designed to
be embedded (from what I read), which may explain why the color space is
not always set (I assume the embedding format would have the color space
information). Mostly a guess.
2018-03-09 21:59:04 +01:00
ca1304da19 plug-ins: make the JP2 loading errors more accurate. 2018-03-09 16:44:13 +01:00
73fbb166b3 plug-ins: robuster tests for image types and minor syntax fixes.
Rather than just assuming all non-gray images are RGB, do a bit more
robust check and reject unknown formats. Indeed even though I see we
took care of YUV, e-YCC and CMYK images above (and normally either
converted them to RGB or already exited with an error), I can see that
the OpenJPEG library could still return OPJ_CLRSPC_UNKNOWN or
OPJ_CLRSPC_UNSPECIFIED. Let's be thorough and not assume we got a SRGB
here.
Also add the alpha-variant tests inside their parent image type
respective test. This should not change anything by any logics, but
let's not leave anything for chance to strike us.

Finally minor coding style fixes:
- Add a space before "if|for" and parenthese.
- Remove some spaces after parentheses.
- Get rid of 2 trailing whitespaces.
- Align function call parameters, declarations, assignments…
2018-03-04 18:27:36 +01:00
53a7c6c3a3 Bug 792141 - Replace jasper with openjpeg.
Made plug-in support the RGB and grayscale with alpha.

Comment by Jehan: this makes the original branch work finally usable on
some JPEG 2000 images. Support of the format is not complete yet though
but at least the port to OpenJPEG is now in usable test.
2018-03-04 18:26:07 +01:00
58a0a65160 file-jp2-load: Switch from Jasper to OpenJPEG library 2018-03-04 18:21:22 +01:00
8796220434 plug-ins: clean out some lost tabs. 2018-02-26 19:12:50 +01:00
912e9baaa6 file-pdf-load: fix plurals 2018-02-18 14:12:03 +03:00
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
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
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
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
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
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
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
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
29fbeb9e02 plug-ins: "port" qbist to float (remove the uchar conversion from float code) 2018-01-08 21:50:20 +01:00
f7fe2753e2 plug-ins: port qbist to GEGL, it's just too cool/weird to get lost 2018-01-08 02:45:54 +01:00
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
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
575013feaa plug-ins: fix a bit of coding styles (spaces and alignment). 2018-01-08 00:07:58 +01:00
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
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
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
8b29687353 Bug 637413 - Saving indexed png with transparency removes one unused color from the colormap 2017-12-31 21:56:54 +01:00
8b68501622 plug-ins: set GimpColorConfig on some color buttons, more to do... 2017-12-31 13:57:41 +01:00
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
9724d7989d Mark legacy plug-ins/scripts as such in menu 2017-12-27 02:40:27 +03:00
0a09452d17 plug-ins: fix my name/email in the goat exercise 2017-12-25 22:35:23 +01:00
2d4715bee9 Bug 791901 - GeglBuffers leaked with Zealous Crop. 2017-12-24 00:39:02 +01:00
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
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
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
657a754f98 Bug 789610: invalid gbr brush crashing GIMP 2017-12-21 21:50:09 +01:00
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
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
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
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
28e95fbeb5 Bug 790849 - (CVE-2017-17789) CVE-2017-17789 Heap buffer overflow...
... in PSP importer.
Check if declared block length is valid (i.e. within the actual file)
before going further.
Consider the file as broken otherwise and fail loading it.
2017-12-20 16:44:20 +01:00
3d5732e23e plug-ins: some minor coding style fix.
Just some missing spaces between function name and parenthese which I
came across.
2017-12-20 15:12:10 +01:00
8ea316667c plug-ins: TGA 16-bit RGB (without alpha bit) is also valid.
According to some spec on the web, 16-bit RGB is also valid. In this
case, the last bit is simply ignored (at least that's how it is
implemented right now).
2017-12-20 13:28:44 +01:00
674b62ad45 Bug 739134 - (CVE-2017-17786) Out of bounds read / heap overflow in...
... TGA importer.

Be more thorough on valid TGA RGB and RGBA images.
In particular current TGA plug-in can import RGBA as 32 bits (8 bits per
channel) and 16 bits (5 bits per color channel and 1 bit for alpha), and
RGB as 15 and 24 bits.
Maybe there exist more variants, but if they do exist, we simply don't
support them yet.

Thanks to Hanno Böck for the report and a first patch attempt.
2017-12-20 13:02:38 +01:00
b05cfc6050 pdb: (try 3) move PDB generation and sources to toplevel/pdb
It never belonged inside "tools". Also rename its "pdb" subdirectory
to "groups". This had to happen before 2.10 so cherry-picking between
branches doesn't become a nightmare in the future.
2017-12-17 14:16:08 -05:00
1b8281269b plug-ins: the file-ps plug-in won't take care about PDF import anymore. 2017-12-13 20:35:41 +01:00
a207570cfe Bug 791397 - Gimp import multi page PDF only imports first page.
Poppler and poppler-data are now hard dependencies.
PDF is a common-enough format nowadays that import support is likely
considered as a granted feature by everyone. Moreover the current
fallback to the PostScript plug-in for PDF support just gives a degraded
experience with less features (and probably a lot of bugs since
basically nobody uses this code).
Poppler-data is also considered mandatory because non-western language
support should never be considered an "option". People using non-western
languages are not second class citizens and therefore if we say that PDF
import is now a hard feature, it should also include PDF using CJK or
Cyrillic languages.
2017-12-13 20:16:24 +01:00
e0c36f3e1b plug-ins: auto-detect HGT variants.
Since SRTM-1 and SRTM-3 data have a fixed image size, it is actually
very easy to auto-detect these by checking the file size. There is no
need to ask the user to select between the 2 variants (even though these
values are made quite obvious by official download links).
I still left the dropdown appear optionally if the detection fails for
some reason (we never know, at least that makes a fallback, for instance
to be able to load partial data!). Yet now by default, HGT file settings
should be fully auto-detected.
2017-12-10 22:50:36 +01:00
43f7a43700 plug-ins: update file-hgt-load description...
... and minor space and indentation fix.
2017-12-10 21:37:24 +01:00
7fce78b2ce plug-ins: properly set returned error in pdb call.
g_set_error() so that when samplespacing is not a valid argument for
file-hgt-load, the error is properly propagated.
Also add a g_warning() to get the error in the terminal as well.
2017-12-10 05:35:36 +01:00
538590ed8b plug-ins: s/GimpPluginPrintError/GimpPluginPDFError/
Likely a copy-paste typo. Nothing serious, but since I saw it, let's fix
it.
2017-12-10 05:35:36 +01:00