From a013c036f3edc80c67ddb9556dd1d9a986cd6af7 Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sat, 2 Apr 2016 02:54:25 -0700 Subject: [PATCH] initialize bmp mr/mg/mb/ma properly --- stb_image.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stb_image.h b/stb_image.h index 893a876..1abe6f4 100644 --- a/stb_image.h +++ b/stb_image.h @@ -4724,6 +4724,7 @@ static void *stbi__bmp_parse_header(stbi__context *s, stbi__bmp_data *info) stbi__get16le(s); // discard reserved info->offset = stbi__get32le(s); info->hsz = hsz = stbi__get32le(s); + info->mr = info->mg = info->mb = info->ma = 0; if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108 && hsz != 124) return stbi__errpuc("unknown BMP", "BMP type not supported: unknown"); if (hsz == 12) { @@ -4752,7 +4753,6 @@ static void *stbi__bmp_parse_header(stbi__context *s, stbi__bmp_data *info) stbi__get32le(s); } if (info->bpp == 16 || info->bpp == 32) { - info->mr = info->mg = info->mb = 0; if (compress == 0) { if (info->bpp == 32) { info->mr = 0xffu << 16;