Skip to content
Permalink
Browse files
pcx: don't overflow buffer if bytes-per-line is less than image width.
  • Loading branch information
icculus committed Feb 7, 2018
1 parent 62cd8cd commit f6769997411b2152ed48d0ec11a062e363bf94fd
Showing 1 changed file with 1 addition and 1 deletion.
@@ -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 */

0 comments on commit f676999

Please sign in to comment.