add layers in the expected order.

2006-04-06  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/compose.c: add layers in the expected order.

	* plug-ins/common/decompose.c: fixed out-of-bounds access to layer
	array (bug #322310).
This commit is contained in:
Sven Neumann 2006-04-06 08:49:32 +00:00 committed by Sven Neumann
parent b78b596d41
commit a883043bac
3 changed files with 23 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2006-04-06 Sven Neumann <sven@gimp.org>
* plug-ins/common/compose.c: add layers in the expected order.
* plug-ins/common/decompose.c: fixed out-of-bounds access to layer
array (bug #322310).
2006-04-06 Michael Natterer <mitch@gimp.org>
* app/plug-in/plug-in-run.[ch]: removed plug_in_repeat()...

View File

@ -1477,6 +1477,7 @@ compose_dialog (const gchar *compose_type,
-1);
g_free (label);
}
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
gtk_widget_show (combo);
@ -1524,10 +1525,17 @@ compose_dialog (const gchar *compose_type,
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
if (nlayers >= compose_dsc[composeint.compose_idx].num_images)
composeint.selected[j].comp.ID = layer_list[nlayers - (j + 1)];
if (composeint.compose_idx >= 0 &&
nlayers >= compose_dsc[composeint.compose_idx].num_images &&
j < nlayers)
{
composeint.selected[j].comp.ID = layer_list[j];
}
else
composeint.selected[j].comp.ID = drawable_ID;
{
composeint.selected[j].comp.ID = drawable_ID;
}
composeint.selected[j].is_ID = TRUE;
combo = gimp_drawable_combo_box_new (check_gray, NULL);

View File

@ -73,6 +73,7 @@ static gint32 create_new_image (const gchar *filename,
GimpDrawable **drawable,
GimpPixelRgn *pixel_rgn);
static gint32 create_new_layer (gint32 image_ID,
gint position,
const gchar *layername,
guint width,
guint height,
@ -512,7 +513,7 @@ decompose (gint32 image_ID,
drawable_dst + j,
pixel_rgn_dst + j);
else
layer_ID_dst[j] = create_new_layer (image_ID_dst[0], layername,
layer_ID_dst[j] = create_new_layer (image_ID_dst[0], j, layername,
width, height, GIMP_GRAY,
drawable_dst + j,
pixel_rgn_dst + j);
@ -593,7 +594,7 @@ create_new_image (const gchar *filename,
gimp_image_set_filename (image_ID, filename);
gimp_image_set_resolution (image_ID, xres, yres);
*layer_ID = create_new_layer (image_ID,
*layer_ID = create_new_layer (image_ID, 0,
layername, width, height, type,
drawable, pixel_rgn);
@ -603,6 +604,7 @@ create_new_image (const gchar *filename,
static gint32
create_new_layer (gint32 image_ID,
gint position,
const gchar *layername,
guint width,
guint height,
@ -631,7 +633,7 @@ create_new_layer (gint32 image_ID,
layer_ID = gimp_layer_new (image_ID, layername, width, height,
gdtype, 100, GIMP_NORMAL_MODE);
gimp_image_add_layer (image_ID, layer_ID, 0);
gimp_image_add_layer (image_ID, layer_ID, position);
*drawable = gimp_drawable_get (layer_ID);
gimp_pixel_rgn_init (pixel_rgn, *drawable, 0, 0, (*drawable)->width,