Skip to content

Commit

Permalink
bmp_read_info_header(): reject bmp files with biBitCount == 0 (#983)
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Aug 14, 2017
1 parent afb308b commit baf0c1a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bin/jp2/convertbmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit baf0c1a

Please sign in to comment.