Skip to content

Commit

Permalink
Reject 2, 3, 5, 6, 7-bpp BMP images
Browse files Browse the repository at this point in the history
BMP decoder assumes less than 8 bit depth images have 1 or 4 bits
per pixel. No other depths are correctly translated to an 8bpp
surface.

This patch rejects loading these images.

https://bugzilla.libsdl.org/show_bug.cgi?id=4498
Signed-off-by: Petr P?sa? <ppisar@redhat.com>
  • Loading branch information
ppisar committed Mar 17, 2019
1 parent 4291cd0 commit 8906afb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/video/SDL_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ SDL_Surface * SDL_LoadBMP_RW (SDL_RWops *src, int freesrc)
break;
}
break;
case 2:
case 3:
case 5:
case 6:
case 7:
SDL_SetError("%d-bpp BMP images are not supported", biBitCount);
was_error = SDL_TRUE;
goto done;
default:
SDL_SetError("Compressed BMP files not supported");
was_error = SDL_TRUE;
Expand Down

0 comments on commit 8906afb

Please sign in to comment.