app/base/temp-buf.c (temp_buf_get_memsize) Add some casts to gsize for

2004-02-13  Manish Singh  <yosh@gimp.org>

        * app/base/temp-buf.c (temp_buf_get_memsize)
        * core/gimpviewable.c (gimp_viewable_get_memsize): Add some casts
        to gsize for ints to prevent overflows.

        * app/base/tile-manager.c (tile_manager_get_memsize): Same as above,
        except cast to gint64.
This commit is contained in:
Manish Singh 2004-02-14 01:12:19 +00:00 committed by Manish Singh
parent ce5e592e23
commit 46aa40e25b
4 changed files with 16 additions and 7 deletions

View File

@ -1,3 +1,12 @@
2004-02-13 Manish Singh <yosh@gimp.org>
* app/base/temp-buf.c (temp_buf_get_memsize)
* core/gimpviewable.c (gimp_viewable_get_memsize): Add some casts
to gsize for ints to prevent overflows.
* app/base/tile-manager.c (tile_manager_get_memsize): Same as above,
except cast to gint64.
2004-02-13 Simon Budig <simon@gimp.org>
* app/core/gimpimage-guides.[ch]: make a similar fix as in my

View File

@ -569,9 +569,9 @@ temp_buf_get_memsize (TempBuf *temp_buf)
}
else
{
memsize += (temp_buf->bytes *
temp_buf->width *
temp_buf->height);
memsize += ((gsize) temp_buf->bytes *
temp_buf->width *
temp_buf->height);
}
return memsize;

View File

@ -616,9 +616,9 @@ tile_manager_get_memsize (const TileManager *tm)
g_return_val_if_fail (tm != NULL, 0);
memsize += (sizeof (TileManager) +
tm->ntile_rows * tm->ntile_cols *
(gint64) tm->ntile_rows * tm->ntile_cols *
(sizeof (Tile) + sizeof (gpointer)) +
tm->width * tm->height * tm->bpp);
(gint64) tm->width * tm->height * tm->bpp);
return memsize;
}

View File

@ -276,8 +276,8 @@ gimp_viewable_get_memsize (GimpObject *object,
}
*gui_size += (pixbuf_instance_size +
gdk_pixbuf_get_height (pixbuf) *
gdk_pixbuf_get_rowstride (pixbuf));
(gsize) gdk_pixbuf_get_height (pixbuf) *
gdk_pixbuf_get_rowstride (pixbuf));
}
return GIMP_OBJECT_CLASS (parent_class)->get_memsize (object, gui_size);