Commit a8252d27 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

properly handle a failure of TIFFFdOpen() instead of crashing on TIFF

2007-11-12  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/tiff-load.c (run): properly handle a failure of
	TIFFFdOpen() instead of crashing on TIFF files we can't handle.

svn path=/trunk/; revision=24130
parent 53b92957
2007-11-12 Sven Neumann <sven@gimp.org>
* plug-ins/common/tiff-load.c (run): properly handle a failure of
TIFFFdOpen() instead of crashing on TIFF files we can't handle.
2007-11-12 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell.c (gimp_display_shell_new): don't
......
......@@ -278,7 +278,7 @@ run (const gchar *name,
if (strcmp (name, LOAD_PROC) == 0)
{
const gchar *filename = param[1].data.d_string;
TIFF *tif;
TIFF *tif = NULL;
gint fd;
fd = g_open (filename, O_RDONLY | _O_BINARY, 0);
......@@ -292,7 +292,10 @@ run (const gchar *name,
else
{
tif = TIFFFdOpen (fd, filename, "r");
}
if (tif)
{
gimp_get_data (LOAD_PROC, &target);
pages.n_pages = pages.o_pages = TIFFNumberOfDirectories (tif);
......@@ -350,12 +353,19 @@ run (const gchar *name,
}
}
else
status = GIMP_PDB_CANCEL;
{
status = GIMP_PDB_CANCEL;
}
}
TIFFClose (tif);
close (fd);
}
else
{
close (fd);
status = GIMP_PDB_EXECUTION_ERROR;
}
}
else
{
......@@ -401,6 +411,7 @@ tiff_error (const gchar *module,
/* Ignore the errors related to random access and JPEG compression */
if (! strcmp (fmt, "Compression algorithm does not support random access"))
return;
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, ap);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment