commit 7941542bab77c93b3f516f200052f1390ec09b0b
Author: Nils Philippsen <nils@redhat.com>
Date:   Thu Dec 3 16:20:09 2009 +0100

    SGI: sanitize input data
    
    Refuse nonsensical zero xsize, ysize, zsize values.

diff --git a/plug-ins/file-sgi/sgi.c b/plug-ins/file-sgi/sgi.c
index f982736..aeef019 100644
--- a/plug-ins/file-sgi/sgi.c
+++ b/plug-ins/file-sgi/sgi.c
@@ -334,6 +334,28 @@ load_image (const gchar  *filename,
    * Get the image dimensions and create the image...
    */
 
+  /* Sanitize dimensions */
+  if (sgip->xsize == 0)
+    {
+      g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+              _("Invalid width: %hu"), sgip->xsize);
+      return -1;
+    }
+
+  if (sgip->ysize == 0)
+    {
+      g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+              _("Invalid height: %hu"), sgip->ysize);
+      return -1;
+    }
+
+  if (sgip->zsize == 0)
+    {
+      g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+              _("Invalid number of channels: %hu"), sgip->zsize);
+      return -1;
+    }
+
   bytes = sgip->zsize;
 
   switch (sgip->zsize)
