Commit graph

10630 commits

Author SHA1 Message Date
Bruno Lopes
c19ed5ca98 plug-ins: Cast g_string_append_c argument to gchar on file-tiff
Silences an Apple Clang warning
2026-03-30 16:09:13 -03:00
Bruno Lopes
94f77bd256 plug-ins: Silence 'register' storage class specifier warning on Clang too 2026-03-29 21:07:00 -03:00
Bruno Lopes
8c0ce0cd64 plug-ins: Fix many type conversions on file-psd
As per Apple Clang warnings.
2026-03-29 18:31:52 -03:00
Bruno Lopes
af1dac3c51 app, plug-ins: Comment unused stuff on macOS
This fixes Apple Clang warnings about:

- idx
- count_large
- count_nan
- n
- iteration
- original_id
- real_pos
2026-03-29 17:19:42 -03:00
Bruno Lopes
f4f1baf5ef app, libgimp, libgimpbase, libgimpwidgets, plug-ins: Add macro to unused code
This fixes Apple Clang warnings about:

- xdiff
- ydiff
- gimp_ui_get_foreign_window
- locale_parser_parse
- use_app_menu
- gimp_unique_dbus*
- transient_set
- gimp_get_foreign_window
- support
2026-03-29 17:19:42 -03:00
Bruno Lopes
0834c7c954 app, plug-ins: Use GINT_TO_POINTER / GPOINTER_TO_INT for portability
Doing traditional explicit conversion (casting) causes warnings.
See: https://docs.gtk.org/glib/conversion-macros.html
2026-03-28 19:51:25 -03:00
Bruno Lopes
41c9d8ce9c plug-ins: Initialize raw_len32 2026-03-28 19:51:25 -03:00
Bruno Lopes
c8c420aa18 app, plug-ins: Comment pixel, total, flags and count unused variables 2026-03-28 19:51:25 -03:00
Alx Sa
2f7b49dfea plug-ins: Change TIM texture indexed conversion
There are reports that clang-based compilers create
a TIM plug-in that crashes when exporting. This seems
related to the method used to convert RGB images to
indexed when choosing TIM textures with palettes on export.

This patch switches to using gimp-image-convert-indexed
instead, to prevent the format mismatch crash on initial export.
2026-03-28 05:56:29 +00:00
Bruno Lopes
1437c84d07 plug-ins: Fix meson warning about missing check: kwarg 2026-03-27 09:53:03 -03:00
Frank Teklote
061a7eada2 file-psd: fix ordering of loaded Photoshop paths
Previously, paths from Photoshop TIFF files were appended via
gimp_image_insert_path(..., -1), which caused the displayed order to be
reversed. This change preserves the original ordering while keeping the
'Working Path' as the last element.
2026-03-27 11:57:50 +00:00
Alx Sa
f52ae69532 plug-ins: Small code style updates to prior commit 2026-03-25 03:29:55 +00:00
Frank Teklote
0de2a56176 file-psd: scan 'ImageSourceData' for 'Layr' block before parsing layers
When loading layer metadata from TIFF 'ImageSourceData' Tag, don't assume
'Layr' is the first 8BIM block. Iterate over 8BIM/MIB8 blocks, skip non
'Layr' blocks, and rewind 4 bytes before calling read_layer_block() so it
can read the length field as expected. Limit mask_layer_len to the
selected block (including padding).
2026-03-24 23:52:50 +00:00
Alx Sa
3f17f528d1 plug-ins: Load more multichannel PSD channels
Multichannel PSD images reuse their first channel as the
main grayscale "layer". Our PSD plug-in did not take this
into account, resulting in the channels being off-by-one and
mislabeled.

This patch prevents chn_a[0].data from being freed after
it is used to load the layer, and then resets the counts so that
it is reused as the first imported channel.
2026-03-24 20:58:29 +00:00
Alx Sa
680ebede22 plug-ins: Read full channel data for PSP selection
968cf06a only loaded the rectangle area that the
selection was contained in, rather than the actual
channel data. This patch extended the code to
also read in the PSP_CHANNEL_BLOCK data, add
it to the selection GeglBuffer, and then shift it over
into the correct location.
2026-03-23 15:07:33 +00:00
Alx Sa
51f1de8844 plug-ins: Add bounds checks to JIF loading
Resolves #16076
As reported by chamal, it is possible to craft a
Jeff's Image Format image with header values that
are larger than the file size. This can lead to buffer
overflows when loading the data. This patch adds
bounding checks based on the size of the stream.
2026-03-21 17:33:39 +00:00
Alx Sa
ccb3cc3ae8 plug-ins: Add bounds check for SFW plug-in
Resolves #16075
As noted by chamal, it is possible to cause a buffer overflow
in a crafted SFW file. This patch adds bounds checks to prevent
this from occurring.
2026-03-21 15:57:01 +00:00
Alx Sa
7612363d8c plug-ins: Clean up PVR import
Resolves #16058

Per mzfr's observations, this patch adds more
safeguards to PVR import. Memory for data and pixels
is allocated and checked rather than using arrays.
Twiddled patterns are increased to 2048 and we
verify the dimensions are in that range before trying
to access. If users share an image that is larger than
that, we can increase this limit further.
2026-03-20 23:33:19 +00:00
Alx Sa
3264a67112 plug-ins: Clean up ICNS file loading
Resolves #16056
Per mzfr, we should check if the cursor exceeds the
icon total size in icns_slurp () (per OSX icons) as we
do already in icns_decompress ().

Additionally, we were not deleting the temp_image created
to load each icon, and in fact we were making an unnecessary
blank temp_image before receiving the one from the PNG &
JPEG2000 procedures. This patch fixes both problems.
2026-03-20 14:10:15 +00:00
Alx Sa
bb3bf0ae5b plug-ins: Allocate memory in PAA plug-in
Per mzfr, we should dynamically allocate memory
for the PAA plug-in pixel data rather than rely on the image
being small enough for an array to store its information.
2026-03-20 12:24:47 +00:00
Alx Sa
b6d43ec0fe plug-ins: Allocate more space for 4bpp TIM textures
Resolves #16052
Per mzfr, the pixel array for 4bpp TIM textures needs to
be allocated twice as large since each byte in the file
stores two pixel indexes when opened.
2026-03-19 12:39:06 +00:00
Alx Sa
e0bd82f290 plug-ins: Protect against too-large FITS images
Resolves #16051
As reported by mzfr, it is possible to crash the FITS plug-in
if a large enough image is read in. This patch implements their
suggestions of using g_try_malloc () over malloc () (and checking
if it returns NULL), as well as verifying the width & height are
within GIMP's image range.
2026-03-19 12:05:47 +00:00
Alx Sa
337cfb6a31 plug-ins: Remove unneeded gegl_buffer_iterator_add()
Resolves #5553
As noted by Massimo, in the Sparkle plug-in there is an
extra gegl_buffer_iterator_add () that is not used in the following
gegl_buffer_iterator_next (iter) loop. Since this adds dest_buffer
which is also written to in the loop in the fspike () functions,
it can cause data to be overwritten. This patch removes the
unneeded extra function call.
2026-03-19 04:07:58 +00:00
Bruno Lopes
a00a227f54 plug-ins: Comment some unused functions on file-dds
To fix GNU Clang warnings
2026-03-18 18:04:11 -03:00
Bruno Lopes
23a17ee000 plug-ins: Comment unused function on sphere-designer
This fixes a warning from GNU CLang
2026-03-18 18:04:11 -03:00
Bruno Lopes
487ee4f5da plug-ins: Clean unused srcrow and src_bytes variables on warp
It was causing warnings on GNU CLang
2026-03-18 18:04:11 -03:00
Jehan
85ad553b09 plug-ins: localize a string. 2026-03-18 17:18:08 +01:00
Bruno Lopes
71c3f29df8 plug-ins: Fix warnings about unused profile_label and cmyk_profile in file-jp2 2026-03-17 22:30:47 -03:00
Sabri Ünal
3a60f800d4 i18n: Mark "Mask image" as translatable
Mark the "Mask image" string as translatable.
2026-03-17 19:10:33 -03:00
Bruno Lopes
9fb127f684 meson: Add explicit build option to build 32-bit TWAIN
It is long-time unmaintained on our repo, with no issues being fixed. Now that
32-bit binaries are not distributed, we can safely move to unmaintained section.
2026-03-17 09:56:20 -03:00
Alx Sa
60d3caa2e2 plug-ins: Copy profile with Tile plug-in
If the user chooses to make a new image when
running the Tile plug-in, the color profile is not
carried over. This can result in the tiled image
looking different. This patch adds calls to
gimp_image_get_color_profile () and
gimp_image_set_color_profile () to ensure the
profile is carried over.
2026-03-15 23:13:14 +00:00
Anders Jonsson
f33200fe8d plug-ins: show default text for licensor_phone_type2 in metadata-editor 2026-03-12 20:04:54 +01:00
Frank Teklote
4576f5a2f1 file-jpeg: fix loading of photoshop path split across multiple segments
Some JPEGs contain large Photoshop path metadata split across multiple APP13 markers. Collect all APP13 payloads and skip the repeated "Photoshop 3.0\0" identifier for subsequent segments so the metadata can be parsed as a single stream.
2026-03-12 15:08:39 +01:00
Alx Sa
f64c9c23ba plug-ins: Mitigate ZDI-CAN-28863
Resolves #15969

It is possible to set the number of color components
in the JPEG 2000 file separate from the color space,
and OpenJPEG reports that value as-is. This can result
in a buffer overflow if the num_components variable is
larger than the number of channels in the color space.

This patch adds a check to make sure num_components
is within range. If it's larger, then we clamp it to the maximum
value for that color model.
2026-03-12 13:48:45 +00:00
Frank Teklote
ee0f2ab8bf file-psd: fix 'path_flatness' being read with wrong type leading to incorrect values 2026-03-12 04:17:02 +00:00
Frank Teklote
a8d1135110 file-psd: fix integer overflow when reading path anchor points
The variable 'cntr' represents the index of all control points of a Photoshop path. It was declared too small, which caused problems with detailed path objects. 'num_rec' is of type 'gint16', but the number of control points is 'num_rec * 6', so 'cntr' must be able to cover that range
2026-03-12 03:25:24 +00:00
Alx Sa
aa8f06db95 plug-ins: Don't show TIFF Reduced Image toggle...
...when there is only one page.
The TIFF load dialog appears when either there are
multiple pages, or we need to make a decision about
how to render the alpha channel.

The "Show reduced images" was shown in both situations,
even though it is not applicable when we only have one page.
This patch modes that code inside the "if (pages->n_pages > 1)"
condition to prevent it from showing when it's not needed.
2026-03-12 03:16:22 +00:00
Frank Teklote
9be00cd3df file-psd: fix invalid layer selection caused by an uninitialized variable: 'layer_state'
Error message:
Calling error for procedure 'gimp-image-set-selected-layers':
Procedure 'gimp-image-set-selected-layers' has been called with value '<not transformable to string>' for argument 'layers' (#2, type GimpCoreObjectArray). This value is out of range.
2026-03-12 02:10:42 +00:00
Jacob Boerema
dbfc7d5b9c tests: fix typo psp has extension psp not psd 2026-03-11 09:28:39 -04:00
Jehan
a50255871c Issue #13066: Opening XPM crashes XPM plugin.
Determining whether we are on X11 or not is a runtime test, not
build-time.
2026-03-10 16:38:21 +00:00
Jacob Boerema
aabce89271 plug-ins:: fix #15960 PCX buffer overflow
A buffer overflow in the PCX reader was reported.

The +1 was added in commit da217088d0
to allow loading where the images have an off by 1 value. However,
this leaves the problem that allocated buffers may be 1 byte too small.

Because we prefer to keep loading as many images as possible, we choose
not to return an error. Instead we allocate 1 extra byte for the
line buffers.
In addition to that, we add check for valid values of bpp and error
out early when invalid.
If the bytesperline value is off by more than 1, we output a warning
message and use the manually computed value instead.

Additionally add a comment that we need to fix a British English
word in a string after string freeze.
2026-03-08 15:18:44 -04:00
Alx Sa
36f594f396 plug-ins: Free temp images in file-dcx-load
Per Jacob Boerema, the DCX loading plug-in left
behind stray images. This is because we load each
PCX image inside the DCX as a separate image and then
copy it as a layer into the first one. However, we were
not deleting the temporary image afterwards.
This patch adds a call to gimp_image_delete () to do
the clean-up work after copying the layer from the
temporary image.
2026-03-08 18:06:38 +00:00
Alx Sa
b4d41182dd plug-ins: Fix ZDI-CAN-28405 for IFF plug-in
Resolves #15289
This patch replaces the initial allocation of pixel_row
with a per-format allocation. This should resolve issues
where the allocation was too small for certain formats,
without requiring a large allocation for all formats regardless
of need.
2026-03-08 14:16:44 +00:00
Alx Sa
edc2b1736b plug-ins: Correct GUI and CMYK logic for JPEG export
Resolves #9545
When exporting a JPEG as CMYK, it is possible for the
"Save Profile" metadata option to be unchecked. This causes
the image to be saved without its CMYK profile, resulting in an
incorrect image rendering.

As this is almost never the desired case, this patch changes the
export logic to always save the profile IF the user has requested
CMYK export and a CMYK profile is attached.

Additionally, this patch fixes an issue in the export dialog where
the DCT options are shown as a radio frame instead of a combobox
as in GIMP 2.10.
2026-03-08 03:45:33 +00:00
Ondřej Míchal
cacccbaf05 plug-ins/gfig: Fix value updates after port from GimpScaleEntry to GimpSpinScale
The new widget is not a subclass of GimpLabelSpin.

Fallout from c3fcbd0019.

Helps with https://gitlab.gnome.org/Teams/GIMP/Design/gimp-ux/-/issues/503.
2026-03-08 03:15:31 +02:00
Jacob Boerema
98cb1371fd plug-ins: fix #15970 buffer overflow in file-psp
Reported as ZDI-CAN-28874.

For psp images with bit depth 1 or 4 bits and small widths, it was
possible to overflow the buffer because these bit depths are stored
in multiples of 4 bytes per line.
Because these formats are converted to regular RGB, this means that for
small widths, more bytes are needed than expected when we are upscaling
to 8-bit.

To fix this, we compute the line size when depth < 8, and adjust
line width if that value is larger.
2026-03-07 15:55:40 -05:00
Jehan
635da347cd plug-ins: improve describing enum and choice arguments.
* Also print the default value for both types of args.
* Display choice values with quotes since they are technically strings.
2026-03-06 22:49:14 +01:00
Jacob Boerema
7e1241f751 plug-ins: fix #15967 integer overflow in psd-load
Reported as ZDI-CAN-28807
With large row and column sizes 32-bit int values are not large
enough to hold the product and thus can cause overflow.

While we are at it, we not only fix the location from the report, but
also other occurrences that could overflow.
- We change certain variables to gsize to make sure they can hold a
64-bit value.
- Other intermediate results are promoted to (gsize) to make sure that
the product is computed as gsize.
- Move some i,j variables to the loops where they are used.
2026-03-06 10:01:09 -05:00
Alx Sa
2e7ed91793 plug-in: Resolve ZDI-CAN-28901 for file-xpm
Resolves #15971
It was possible to set a XPM image to have a width and/or height
that is larger than what GIMP can create an image for. In addition to
causing gimp_image_new () to fail, it can also lead to buffer overflow
when allocating space to read in the image.

This patch adds a GError parameter to parse_image (), then uses it to
pass up an error for either oversized images or buffer overflows.
2026-03-06 13:54:44 +00:00
Alx Sa
09e5459de9 plug-ins: Resolve ZDI-CAN-28813 in ANI loading
Resolves #15968
It is possible to cause a buffer overflow in our ANI
loading code by setting the Name or Artist metadata
files to 0xFFFFFFFF. This patch changes our allocation
code to use g_try_new0 () instead of g_new0 (), and
verifies if it is NULL before trying to read data into it.
2026-03-05 23:58:45 +00:00