# HG changeset patch
# User Ryan C. Gordon <icculus@icculus.org>
# Date 1516776304 18000
# Node ID 97f7f01e0665b7555a0e5e9465799e80c8f59528
# Parent  16772bbb1b094edcbd28a23979fa4089a9d560be
lbm: Fail to load images with unsupported/bogus color depth.

diff -r 16772bbb1b09 -r 97f7f01e0665 IMG_lbm.c
--- a/IMG_lbm.c	Wed Jan 24 01:44:36 2018 -0500
+++ b/IMG_lbm.c	Wed Jan 24 01:45:04 2018 -0500
@@ -233,6 +233,12 @@
         nbplanes = 1;
     }
 
+    if ((nbplanes != 1) && (nbplanes != 4) && (nbplanes != 8) && (nbplanes != 24))
+    {
+        error="unsupported number of color planes";
+        goto done;
+    }
+
     stencil = (bmhd.mask & 1);   /* There is a mask ( 'stencil' ) */
 
     /* Allocate memory for a temporary buffer ( used for
