Handle global_error == NULL better. (tiff_image_parse): Don't trust

* io-tiff.c (tiff_set_error): Handle global_error == NULL
	better.
	(tiff_image_parse): Don't trust TIFFRGBAImageBegin to set
	the "put" routine.  (Fixes #87384)
	(gdk_pixbuf__tiff_image_stop_load): Don't call TIFFClose too
	early.
This commit is contained in:
Matthias Clasen 2002-07-06 08:55:51 +00:00
parent 367cacdf1b
commit 09487ff9f5
2 changed files with 32 additions and 7 deletions

View File

@ -1,3 +1,12 @@
2002-07-06 Matthias Clasen <maclas@gmx.de>
* io-tiff.c (tiff_set_error): Handle global_error == NULL
better.
(tiff_image_parse): Don't trust TIFFRGBAImageBegin to set
the "put" routine. (Fixes #87384)
(gdk_pixbuf__tiff_image_stop_load): Don't call TIFFClose too
early.
2002-07-02 Matthias Clasen <maclas@gmx.de> 2002-07-02 Matthias Clasen <maclas@gmx.de>
Miscellaneous bmp loader fixes (#85448, #86286, #86287): Miscellaneous bmp loader fixes (#85448, #86286, #86287):

View File

@ -119,16 +119,20 @@ tiff_set_error (GError **error,
/* Take the error message from libtiff and merge it with /* Take the error message from libtiff and merge it with
* some context we provide. * some context we provide.
*/ */
g_set_error (error,
GDK_PIXBUF_ERROR,
error_code,
"%s%s%s",
msg, global_error ? ": " : "", global_error);
if (global_error) { if (global_error) {
g_set_error (error,
GDK_PIXBUF_ERROR,
error_code,
"%s%s%s", msg, ": ", global_error);
g_free (global_error); g_free (global_error);
global_error = NULL; global_error = NULL;
} }
else {
g_set_error (error,
GDK_PIXBUF_ERROR,
error_code, msg);
}
} }
@ -256,6 +260,14 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
return NULL; return NULL;
} }
if (img.put.any == NULL) {
tiff_set_error (error,
GDK_PIXBUF_ERROR_FAILED,
_("Unsupported TIFF variant"));
g_object_unref (pixbuf);
return NULL;
}
if (img.isContig) { if (img.isContig) {
tiff_put_contig = img.put.contig; tiff_put_contig = img.put.contig;
img.put.contig = put_contig; img.put.contig = put_contig;
@ -476,16 +488,20 @@ gdk_pixbuf__tiff_image_stop_load (gpointer data,
if (pixbuf) if (pixbuf)
g_object_unref (pixbuf); g_object_unref (pixbuf);
retval = pixbuf != NULL; retval = pixbuf != NULL;
TIFFClose (tiff);
if (global_error) if (global_error)
{ {
tiff_set_error (error, tiff_set_error (error,
GDK_PIXBUF_ERROR_FAILED, GDK_PIXBUF_ERROR_FAILED,
_("Failed to load TIFF image")); _("Failed to load TIFF image"));
tiff_pop_handlers ();
retval = FALSE; retval = FALSE;
} }
} }
if (tiff)
TIFFClose (tiff);
g_assert (!global_error); g_assert (!global_error);
g_free (context->buffer); g_free (context->buffer);