From: Even Rouault Date: Mon, 14 Aug 2017 15:26:58 +0000 (+0200) Subject: bmp_read_info_header(): reject bmp files with biBitCount == 0 (#983) X-Git-Tag: v2.3.0~82 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=baf0c1ad4572daa89caa3b12985bdd93530f0dd7;p=openjpeg bmp_read_info_header(): reject bmp files with biBitCount == 0 (#983) --- diff --git a/src/bin/jp2/convertbmp.c b/src/bin/jp2/convertbmp.c index b49e7a08..2715fdf2 100644 --- a/src/bin/jp2/convertbmp.c +++ b/src/bin/jp2/convertbmp.c @@ -392,6 +392,10 @@ static OPJ_BOOL bmp_read_info_header(FILE* IN, OPJ_BITMAPINFOHEADER* header) header->biBitCount = (OPJ_UINT16)getc(IN); header->biBitCount |= (OPJ_UINT16)((OPJ_UINT32)getc(IN) << 8); + if (header->biBitCount == 0) { + fprintf(stderr, "Error, invalid biBitCount %d\n", 0); + return OPJ_FALSE; + } if (header->biSize >= 40U) { header->biCompression = (OPJ_UINT32)getc(IN);