summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2017-12-05 10:40:44 +0100
committerBastien Nocera <hadess@hadess.net>2017-12-05 10:42:39 +0100
commit9aa37e998282bcf6b2ac0705345ab2017d4b2c9b (patch)
treedd519964b198ca37387450a3e8c6b675bbfc56fc
parent4ea4a3f9989a57fca57958c85cba1fca60216767 (diff)
downloadgdk-pixbuf-9aa37e998282bcf6b2ac0705345ab2017d4b2c9b.tar.gz
jpeg: Prevent crashes when stopping loading broken files
A follow-up from commit b99e04f, to avoid trying to access pixel data in a pixbuf that doesn't exist any more.
-rw-r--r--gdk-pixbuf/io-jpeg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
index 1cd3d3019..6d9169f75 100644
--- a/gdk-pixbuf/io-jpeg.c
+++ b/gdk-pixbuf/io-jpeg.c
@@ -851,7 +851,8 @@ gdk_pixbuf__jpeg_image_stop_load (gpointer data, GError **error)
cinfo = &context->cinfo;
/* Try to finish loading truncated files */
- if (cinfo->output_scanline < cinfo->output_height) {
+ if (context->pixbuf &&
+ cinfo->output_scanline < cinfo->output_height) {
my_src_ptr src = (my_src_ptr) cinfo->src;
/* But only if there's enough buffer space left */