diff options
author | Philip Withnall <philip@tecnocode.co.uk> | 2017-01-07 17:13:30 +0000 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2017-02-07 11:35:40 +0000 |
commit | 2634506c2f3897fc83dd3049210fffa5edccf3eb (patch) | |
tree | 56adcfcfbfd7b62aee96c92409460d07ecba83ea | |
parent | ab921f069d2624de547c9a15252fb278de2baf13 (diff) | |
download | gdk-pixbuf-2634506c2f3897fc83dd3049210fffa5edccf3eb.tar.gz |
gdk-pixbuf-loader: Add a missing NULL check
The code just above checks whether image_module is NULL, and it doesn’t
look like it can change in the meantime, so we should also check before
dereferencing it for load_increment.
Make this an assertion; although we’re not entirely sure how this code
was originally supposed to work, we’re still in development, so we can
investigate any assertion failures with impunity.
Coverity CID: 1388529
https://bugzilla.gnome.org/show_bug.cgi?id=776990
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-loader.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c index f6d58786f..9f0fa79c6 100644 --- a/gdk-pixbuf/gdk-pixbuf-loader.c +++ b/gdk-pixbuf/gdk-pixbuf-loader.c @@ -516,7 +516,10 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader, buf += eaten; } - if (count > 0 && priv->image_module->load_increment) + /* By this point, we expect the image_module to have been loaded. */ + g_assert (priv->image_module != NULL); + + if (count > 0 && priv->image_module->load_increment != NULL) { if (!priv->image_module->load_increment (priv->context, buf, count, error)) |