plug-ins: fix a crash in tiff_io_error().
I had a TIFF file which would crash while triggering an error, inside g_logv()
code (and according to the stacktrace, even probably inside some lower level
printf implementation code).
The reason was that I already processed the variable list with
g_strdup_vprintf() and printf didn't like this va_list being reused, then
segfaulted with some "Cannot access memory at address" error.
The alternate fix was to first copy the va_list in the first use with
va_copy()/G_VA_COPY, yet since we already processed the format data, I thought
it was useless to do this. Let's just directly use the formatted string.
(cherry picked from commit fb1f16d4b8
)
This commit is contained in:
@ -282,32 +282,29 @@ tiff_io_error (const gchar *module,
|
||||
const gchar *fmt,
|
||||
va_list ap)
|
||||
{
|
||||
gchar *msg;
|
||||
|
||||
/* Workaround for: http://bugzilla.gnome.org/show_bug.cgi?id=132297
|
||||
* Ignore the errors related to random access and JPEG compression
|
||||
*/
|
||||
if (! strcmp (fmt, "Compression algorithm does not support random access"))
|
||||
return;
|
||||
|
||||
msg = g_strdup_vprintf (fmt, ap);
|
||||
|
||||
#ifdef TIFF_VERSION_BIG
|
||||
if (g_strcmp0 (fmt, "Maximum TIFF file size exceeded") == 0)
|
||||
{
|
||||
/* @module in my tests were "TIFFAppendToStrip" but I wonder if
|
||||
* this same error could not happen with other "modules".
|
||||
*/
|
||||
tiff_file_size_error = TRUE;
|
||||
}
|
||||
/* @module in my tests were "TIFFAppendToStrip" but I wonder if
|
||||
* this same error could not happen with other "modules".
|
||||
*/
|
||||
tiff_file_size_error = TRUE;
|
||||
else
|
||||
{
|
||||
gchar *msg = g_strdup_vprintf (fmt, ap);
|
||||
|
||||
/* Easier for debugging to at least print messages on stderr; */
|
||||
g_printerr ("LibTiff error: [%s] %s\n", module, msg);
|
||||
g_free (msg);
|
||||
}
|
||||
|
||||
/* Easier for debugging to at least print messages on stderr. */
|
||||
g_printerr ("LibTiff error: [%s] %s\n", module, msg);
|
||||
#endif
|
||||
|
||||
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, ap);
|
||||
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, "%s", msg);
|
||||
g_free (msg);
|
||||
}
|
||||
|
||||
static tsize_t
|
||||
|
Reference in New Issue
Block a user