Skip to content

Commit

Permalink
ico: reject obviously incorrect image sizes.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jan 24, 2018
1 parent 1559b5c commit da6a5c5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions IMG_bmp.c
Expand Up @@ -735,6 +735,14 @@ LoadICOCUR_RW(SDL_RWops * src, int type, int freesrc)
goto done;
}

/* sanity check image size, so we don't overflow integers, etc. */
if ((biWidth < 0) || (biWidth > 0xFFFFFF) ||
(biHeight < 0) || (biHeight > 0xFFFFFF)) {
IMG_SetError("Unsupported or invalid ICO dimensions");
was_error = SDL_TRUE;
goto done;
}

/* Create a RGBA surface */
biHeight = biHeight >> 1;
//printf("%d x %d\n", biWidth, biHeight);
Expand Down

0 comments on commit da6a5c5

Please sign in to comment.