From 870d5f2511fa58c19f9464e62d8972022f5953b1 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Mon, 17 Nov 2008 19:56:28 +0000 Subject: Stricter sanity check git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2152 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- src/ithumb-writer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ithumb-writer.c b/src/ithumb-writer.c index c5d73f4..3c22268 100644 --- a/src/ithumb-writer.c +++ b/src/ithumb-writer.c @@ -107,7 +107,8 @@ pack_RGB_565 (GdkPixbuf *pixbuf, const Itdb_ArtworkFormat *img_info, "rowstride", &row_stride, "n-channels", &channels, "height", &height, "width", &width, "pixels", &pixels, NULL); - g_return_val_if_fail ((width <= img_info->width) && (height <= img_info->height), NULL); + g_return_val_if_fail (((width + horizontal_padding) <= img_info->width), NULL); + g_return_val_if_fail (((height + vertical_padding) <= img_info->height), NULL); if ((img_info->align_row_bytes) && ((img_info->width % 2) != 0)) { /* each pixel is 2 bytes, to align rows on 4 bytes boundaries, @@ -214,7 +215,8 @@ pack_RGB_555 (GdkPixbuf *pixbuf, const Itdb_ArtworkFormat *img_info, "rowstride", &row_stride, "n-channels", &channels, "height", &height, "width", &width, "pixels", &pixels, NULL); - g_return_val_if_fail ((width <= img_info->width) && (height <= img_info->height), NULL); + g_return_val_if_fail (((width + horizontal_padding) <= img_info->width), NULL); + g_return_val_if_fail (((height + vertical_padding) <= img_info->height), NULL); if ((img_info->align_row_bytes) && ((img_info->width % 2) != 0)) { /* each pixel is 2 bytes, to align rows on 4 bytes boundaries, @@ -320,6 +322,8 @@ pack_RGB_888 (GdkPixbuf *pixbuf, const Itdb_ArtworkFormat *img_info, "rowstride", &row_stride, "n-channels", &channels, "height", &height, "width", &width, "pixels", &pixels, NULL); + g_return_val_if_fail (((width + horizontal_padding) <= img_info->width), NULL); + g_return_val_if_fail (((height + vertical_padding) <= img_info->height), NULL); g_return_val_if_fail ((width <= img_info->width) && (height <= img_info->height), NULL); /* Make sure thumb size calculation won't overflow */ -- cgit