diff --git a/ChangeLog b/ChangeLog index 67395508f7..31a3e25ba5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-05-17 Michael Natterer + + * app/core/gimpbrushclipboard.c + (gimp_brush_clipboard_buffer_changed) + * app/core/gimppatternclipboard.c + (gimp_pattern_clipboard_buffer_changed): limit the size of + clipboard brushes and patterns to 512x512 pixels to prevent OOM + conditions when copying from huge drawables. + 2006-05-17 Bill Skaggs * app/tools/gimpaligntool.[ch]: major change in ui, to make diff --git a/app/core/gimpbrushclipboard.c b/app/core/gimpbrushclipboard.c index dc6b79191d..864478b9d5 100644 --- a/app/core/gimpbrushclipboard.c +++ b/app/core/gimpbrushclipboard.c @@ -210,8 +210,8 @@ gimp_brush_clipboard_buffer_changed (Gimp *gimp, TileManager *tiles = gimp->global_buffer->tiles; GimpImageType type = gimp_buffer_get_image_type (gimp->global_buffer); - width = gimp_buffer_get_width (gimp->global_buffer); - height = gimp_buffer_get_height (gimp->global_buffer); + width = MIN (gimp_buffer_get_width (gimp->global_buffer), 512); + height = MIN (gimp_buffer_get_height (gimp->global_buffer), 512); brush->mask = temp_buf_new (width, height, 1, 0, 0, NULL); brush->pixmap = temp_buf_new (width, height, 3, 0, 0, NULL); diff --git a/app/core/gimppatternclipboard.c b/app/core/gimppatternclipboard.c index 8d33685e7c..09f8050356 100644 --- a/app/core/gimppatternclipboard.c +++ b/app/core/gimppatternclipboard.c @@ -198,16 +198,19 @@ gimp_pattern_clipboard_buffer_changed (Gimp *gimp, if (gimp->global_buffer) { - TileManager *tiles = gimp->global_buffer->tiles; - gint width = gimp_buffer_get_width (gimp->global_buffer); - gint height = gimp_buffer_get_height (gimp->global_buffer); - gint bytes = gimp_buffer_get_bytes (gimp->global_buffer); + gint width; + gint height; + gint bytes; PixelRegion bufferPR; PixelRegion maskPR; + width = MIN (gimp_buffer_get_width (gimp->global_buffer), 512); + height = MIN (gimp_buffer_get_height (gimp->global_buffer), 512); + bytes = gimp_buffer_get_bytes (gimp->global_buffer); + pattern->mask = temp_buf_new (width, height, bytes, 0, 0, NULL); - pixel_region_init (&bufferPR, tiles, + pixel_region_init (&bufferPR, gimp->global_buffer->tiles, 0, 0, width, height, FALSE); pixel_region_init_temp_buf (&maskPR, pattern->mask, 0, 0, width, height);