Blob Blame History Raw
From 038a7856695cea40c0ec02075fbbb427a64d6d43 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Wed, 29 May 2019 04:47:32 -0400
Subject: [PATCH 1/2] Fix reading bits-per-pixel from BMP header.

This seem to work on little-endian machines since the following data was
apparently zeros, but doesn't work on big-endian machines.

Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
 subprojects/libinsane/src/bmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/subprojects/libinsane/src/bmp.c b/subprojects/libinsane/src/bmp.c
index 5841d6f..886a368 100644
--- a/subprojects/libinsane/src/bmp.c
+++ b/subprojects/libinsane/src/bmp.c
@@ -67,9 +67,9 @@ enum lis_error lis_bmp2scan_params(
 		);
 		return LIS_ERR_INTERNAL_IMG_FORMAT_NOT_SUPPORTED;
 	}
-	if (le32toh(header->nb_bits_per_pixel) != 24) {
+	if (le16toh(header->nb_bits_per_pixel) != 24) {
 		lis_log_error("BMP: Unexpected nb bits per pixel: %u (0x%X)",
-				le32toh(header->nb_bits_per_pixel),
+				le16toh(header->nb_bits_per_pixel),
 				header->nb_bits_per_pixel);
 		return LIS_ERR_INTERNAL_IMG_FORMAT_NOT_SUPPORTED;
 	}
-- 
2.21.0