diff options
| author | Christophe Fergeau <teuf@gnome.org> | 2008-11-17 19:56:28 +0000 |
|---|---|---|
| committer | Christophe Fergeau <teuf@gnome.org> | 2008-11-17 19:56:28 +0000 |
| commit | 870d5f2511fa58c19f9464e62d8972022f5953b1 (patch) | |
| tree | 9904efd2d5c83304791186524491b8bdb6c60632 | |
| parent | f9d3f5dd415b48d6f7a8092737add02c98f3a0b6 (diff) | |
| download | libgpod-870d5f2511fa58c19f9464e62d8972022f5953b1.tar.gz libgpod-870d5f2511fa58c19f9464e62d8972022f5953b1.tar.xz libgpod-870d5f2511fa58c19f9464e62d8972022f5953b1.zip | |
Stricter sanity check
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2152 f01d2545-417e-4e96-918e-98f8d0dbbcb6
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | src/ithumb-writer.c | 8 |
2 files changed, 10 insertions, 2 deletions
@@ -1,5 +1,9 @@ 2008-11-17 Christophe Fergeau <teuf@gnome.org> + * src/ithumb-writer.c: stricter sanity check + +2008-11-17 Christophe Fergeau <teuf@gnome.org> + * src/ithumb-writer.c: add checks for int overflows on malloc args 2008-11-14 Todd Zullinger <tmzullinger at users.sourceforge.net> 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 */ |
