[gimp] Bug 727832 - file-psd-load infinite loop
- From: Hartmut Kuhse <hartmutkuhse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 727832 - file-psd-load infinite loop
- Date: Mon, 21 Apr 2014 17:26:04 +0000 (UTC)
commit 7b078a6e57438465f5fbc8048cb323512c716c8e
Author: Hartmut Kuhse <hk_priv gmx de>
Date: Mon Apr 21 19:22:02 2014 +0200
Bug 727832 - file-psd-load infinite loop
If a layer mask is completely outside the layer boundaries,
the layer mask is omitted
plug-ins/file-psd/psd-load.c | 45 ++++++++++++++++++++++++-----------------
1 files changed, 26 insertions(+), 19 deletions(-)
---
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index b4af437..731278f 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -1476,26 +1476,33 @@ add_layers (gint32 image_id,
lm_h = l_h - lm_y;
}
else
- memcpy (pixels, lyr_chn[user_mask_chn]->data, layer_size);
+ {
+ memcpy (pixels, lyr_chn[user_mask_chn]->data, layer_size);
+ i = layer_size;
+ }
g_free (lyr_chn[user_mask_chn]->data);
- /* Draw layer mask data */
- IFDBG(3) g_debug ("Layer %d %d %d %d", l_x, l_y, l_w, l_h);
- IFDBG(3) g_debug ("Mask %d %d %d %d", lm_x, lm_y, lm_w, lm_h);
-
- if (lyr_a[lidx]->layer_mask.def_color == 255)
- mask_id = gimp_layer_create_mask (layer_id, GIMP_ADD_WHITE_MASK);
- else
- mask_id = gimp_layer_create_mask (layer_id, GIMP_ADD_BLACK_MASK);
-
- IFDBG(3) g_debug ("New layer mask %d", mask_id);
- gimp_layer_add_mask (layer_id, mask_id);
- buffer = gimp_drawable_get_buffer (mask_id);
- gegl_buffer_set (buffer, GEGL_RECTANGLE (lm_x, lm_y, lm_w, lm_h), 0,
- get_pixel_format (img_a), pixels, GEGL_AUTO_ROWSTRIDE);
- g_object_unref (buffer);
- gimp_layer_set_apply_mask (layer_id,
- ! lyr_a[lidx]->layer_mask.mask_flags.disabled);
- g_free (pixels);
+ /* Draw layer mask data, if any */
+ if (i > 0)
+ {
+ IFDBG(3) g_debug ("Layer %d %d %d %d", l_x, l_y, l_w, l_h);
+ IFDBG(3) g_debug ("Mask %d %d %d %d", lm_x, lm_y, lm_w, lm_h);
+
+ if (lyr_a[lidx]->layer_mask.def_color == 255)
+ mask_id = gimp_layer_create_mask (layer_id, GIMP_ADD_WHITE_MASK);
+ else
+ mask_id = gimp_layer_create_mask (layer_id, GIMP_ADD_BLACK_MASK);
+
+ IFDBG(3) g_debug ("New layer mask %d", mask_id);
+ gimp_layer_add_mask (layer_id, mask_id);
+ buffer = gimp_drawable_get_buffer (mask_id);
+ gegl_buffer_set (buffer, GEGL_RECTANGLE (lm_x, lm_y, lm_w, lm_h), 0,
+ get_pixel_format (img_a), pixels, GEGL_AUTO_ROWSTRIDE);
+ g_object_unref (buffer);
+ gimp_layer_set_apply_mask (layer_id,
+ ! lyr_a[lidx]->layer_mask.mask_flags.disabled);
+ }
+ if (pixels)
+ g_free (pixels);
}
}
for (cidx = 0; cidx < lyr_a[lidx]->num_channels; ++cidx)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]