From 47378716ab03d6b39ee959c949df551c643942f1 Mon Sep 17 00:00:00 2001 From: Peter Szabo Date: Tue, 27 Feb 2018 15:13:02 +0100 Subject: [PATCH] bugfix: added error reporting on invalid BMP bpp value; this fixes https://github.com/pts/sam2p/issues/21 --- input-bmp.ci | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/input-bmp.ci b/input-bmp.ci index 61bc56d..48fd5f6 100644 --- a/input-bmp.ci +++ b/input-bmp.ci @@ -172,6 +172,12 @@ bitmap_type bmp_load_image (at_string filename) if (Maps != 3 && Maps != 4) FATALP("BMP: Bad color_size."); + switch (Bitmap_Head.biBitCnt) { + case 32: case 24: case 16: case 8: case 4: case 2: case 1: break; + default: + FATALP ("BMP: Invalid bpp."); + } + /* Valid options 1, 4, 8, 16, 24, 32 */ /* 16 is awful, we should probably shoot whoever invented it */