Skip to content

Commit 1559b5c

Browse files
committed
lbm: Don't overflow static colormap buffer.
1 parent b48777d commit 1559b5c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

IMG_lbm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ SDL_Surface *IMG_LoadLBM_RW( SDL_RWops *src )
183183

184184
if ( !SDL_memcmp( id, "CMAP", 4 ) ) /* palette ( Color Map ) */
185185
{
186+
if (size > sizeof (colormap)) {
187+
error="colormap size is too large";
188+
goto done;
189+
}
190+
186191
if ( !SDL_RWread( src, &colormap, size, 1 ) )
187192
{
188193
error="error reading CMAP chunk";

0 commit comments

Comments
 (0)