Set the GError if the image is zero length. (#405327)

2007-02-07  Chris Wilson  <chris@chris-wilson.co.uk>

	* io-jpeg.c: (gdk_pixbuf__jpeg_image_load),
	(gdk_pixbuf__jpeg_image_load_increment): Set the GError
	if the image is zero length. (#405327)


svn path=/trunk/; revision=17272
This commit is contained in:
Chris Wilson 2007-02-07 14:47:36 +00:00 committed by Chris Wilson
parent 94e19baaae
commit 74747e38c9
2 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2007-02-07 Chris Wilson <chris@chris-wilson.co.uk>
* io-jpeg.c: (gdk_pixbuf__jpeg_image_load),
(gdk_pixbuf__jpeg_image_load_increment): Set the GError
if the image is zero length. (#405327)
2007-02-06 Matthias Clasen <mclasen@redhat.com>
* gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Protect

View File

@ -307,6 +307,8 @@ gdk_pixbuf__jpeg_image_load (FILE *f, GError **error)
g_object_unref (pixbuf);
jpeg_destroy_decompress (&cinfo);
/* error should have been set by fatal_error_handler () */
return NULL;
}
@ -715,8 +717,13 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
height = cinfo->image_height;
if (context->size_func) {
(* context->size_func) (&width, &height, context->user_data);
if (width == 0 || height == 0)
if (width == 0 || height == 0) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed JPEG has zero width or height."));
return FALSE;
}
}
for (cinfo->scale_denom = 2; cinfo->scale_denom <= 8; cinfo->scale_denom *= 2) {