Skip to content

Commit

Permalink
We don't currently support blitting to < 8 bpp surfaces, return an er…
Browse files Browse the repository at this point in the history
…ror instead of corrupting memory in that case.
  • Loading branch information
slouken committed Jan 1, 2017
1 parent 2ba66d0 commit 49225f5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/video/SDL_blit.c
Expand Up @@ -219,6 +219,12 @@ SDL_CalculateBlit(SDL_Surface * surface)
SDL_BlitMap *map = surface->map;
SDL_Surface *dst = map->dst;

/* We don't currently support blitting to < 8 bpp surfaces */
if (dst->format->BitsPerPixel < 8) {
SDL_InvalidateMap(map);
return SDL_SetError("Blit combination not supported");
}

/* Clean everything out to start */
if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
SDL_UnRLESurface(surface, 1);
Expand Down

0 comments on commit 49225f5

Please sign in to comment.