Skip to content

Commit da6a5c5

Browse files
committed
ico: reject obviously incorrect image sizes.
1 parent 1559b5c commit da6a5c5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

IMG_bmp.c

+8
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,14 @@ LoadICOCUR_RW(SDL_RWops * src, int type, int freesrc)
735735
goto done;
736736
}
737737

738+
/* sanity check image size, so we don't overflow integers, etc. */
739+
if ((biWidth < 0) || (biWidth > 0xFFFFFF) ||
740+
(biHeight < 0) || (biHeight > 0xFFFFFF)) {
741+
IMG_SetError("Unsupported or invalid ICO dimensions");
742+
was_error = SDL_TRUE;
743+
goto done;
744+
}
745+
738746
/* Create a RGBA surface */
739747
biHeight = biHeight >> 1;
740748
//printf("%d x %d\n", biWidth, biHeight);

0 commit comments

Comments
 (0)