Commit 12598750 authored by Paolo Bacchilega's avatar Paolo Bacchilega

jpeg loader: fixed abort in case of error

do not call siglongjmp more then once in case of error
parent 8a990fa4
......@@ -48,34 +48,28 @@ static void
fatal_error_handler (j_common_ptr cinfo)
{
struct error_handler_data *errmgr;
char buffer[JMSG_LENGTH_MAX];
errmgr = (struct error_handler_data *) cinfo->err;
if ((errmgr->error != NULL) && (*errmgr->error == NULL)) {
char buffer[JMSG_LENGTH_MAX];
/* Create the message */
(* cinfo->err->format_message) (cinfo, buffer);
/* Create the message */
(* cinfo->err->format_message) (cinfo, buffer);
/* broken check for *error == NULL for robustness against
* crappy JPEG library
*/
if (errmgr->error && *errmgr->error == NULL) {
g_set_error (errmgr->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
g_set_error (errmgr->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Error interpreting JPEG image file: %s"),
buffer);
}
siglongjmp (errmgr->setjmp_buffer, 1);
g_assert_not_reached ();
buffer);
siglongjmp (errmgr->setjmp_buffer, 1);
}
}
static void
output_message_handler (j_common_ptr cinfo)
{
/* This method keeps libjpeg from dumping crap to stderr */
/* This method keeps libjpeg from dumping text to stderr */
/* do nothing */
}
......@@ -588,6 +582,7 @@ _cairo_image_surface_create_from_jpeg (GInputStream *istream,
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CANCELLED, "");
cairo_surface_destroy (surface);
surface = NULL;
}
if (read_all_scanlines)
......
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