Reject 2, 3, 5, 6, 7-bpp BMP images SDL-1.2
authorPetr Písař <ppisar@redhat.com>
Sat, 16 Mar 2019 18:35:33 -0700
branchSDL-1.2
changeset 126464646533663ae
parent 12645 08f3b4992538
child 12653 9b0e5c555c0f
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>
src/video/SDL_bmp.c
     1.1 --- a/src/video/SDL_bmp.c	Sat Mar 16 18:35:11 2019 -0700
     1.2 +++ b/src/video/SDL_bmp.c	Sat Mar 16 18:35:33 2019 -0700
     1.3 @@ -222,6 +222,14 @@
     1.4  					break;
     1.5  			}
     1.6  			break;
     1.7 +		case 2:
     1.8 +		case 3:
     1.9 +		case 5:
    1.10 +		case 6:
    1.11 +		case 7:
    1.12 +			SDL_SetError("%d-bpp BMP images are not supported", biBitCount);
    1.13 +			was_error = SDL_TRUE;
    1.14 +			goto done;
    1.15  		default:
    1.16  			SDL_SetError("Compressed BMP files not supported");
    1.17  			was_error = SDL_TRUE;