# HG changeset patch # User Ryan C. Gordon # Date 1516816924 18000 # Node ID a1e9b624ca1033f893e93691802682bf36400f7a # Parent bfa08dc02b3c7b265ead6019f901f17f925570c3 ico: reject obviously incorrect image sizes. diff -r bfa08dc02b3c -r a1e9b624ca10 IMG_bmp.c --- a/IMG_bmp.c Wed Jan 24 12:00:24 2018 -0500 +++ b/IMG_bmp.c Wed Jan 24 13:02:04 2018 -0500 @@ -735,6 +735,14 @@ 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);