Skip to content
Permalink
Browse files
Reject 2, 3, 5, 6, 7-bpp BMP images
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 8906afbaf2629967bed95ae5b693a4f8ba3f4e18
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/video/SDL_bmp.c
@@ -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;

0 comments on commit 8906afb

Please sign in to comment.