Skip to content

Commit

Permalink
pcx: don't overflow buffer if bytes-per-line is less than image width.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 7, 2018
1 parent 62cd8cd commit f676999
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion IMG_pcx.c
Expand Up @@ -147,7 +147,7 @@ SDL_Surface *IMG_LoadPCX_RW(SDL_RWops *src)
if (bpl > surface->pitch) {
error = "bytes per line is too large (corrupt?)";
}
buf = (Uint8 *)SDL_malloc(bpl);
buf = (Uint8 *)SDL_calloc(SDL_max(bpl, surface->pitch), 1);
row = (Uint8 *)surface->pixels;
for ( y=0; y<surface->h; ++y ) {
/* decode a scan line to a temporary buffer first */
Expand Down

0 comments on commit f676999

Please sign in to comment.