From 67615b575a683a7e28387dda65ae8976ac999290 Mon Sep 17 00:00:00 2001 From: Felix Riemann Date: Sun, 2 Aug 2020 20:42:32 +0200 Subject: PNM: Generate an error if no pixbuf could be produced This is expected by the loader API which trips over an assertion otherwise. Partially loaded images still work while images that are too truncated fail gracefully. Fixes #111. --- gdk-pixbuf/io-pnm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gdk-pixbuf/io-pnm.c b/gdk-pixbuf/io-pnm.c index 91e7dca67..856501ae5 100644 --- a/gdk-pixbuf/io-pnm.c +++ b/gdk-pixbuf/io-pnm.c @@ -873,6 +873,12 @@ gdk_pixbuf__pnm_image_stop_load (gpointer data, if (context->pixbuf) g_object_unref (context->pixbuf); + else { + g_set_error_literal (error, GDK_PIXBUF_ERROR, + GDK_PIXBUF_ERROR_CORRUPT_IMAGE, + _("Premature end-of-file encountered")); + retval = FALSE; + } #if 0 /* We should ignore trailing newlines and we can't -- cgit v1.2.1