[Commits] SDL_image: pcx: don't overflow buffer if bytes-per-line is less ...

libsdl.org revision control commits-owner at libsdl.org
Wed Feb 7 12:43:56 PST 2018


details:   https://hg.libsdl.org/SDL_image/rev/2938fc80591a
changeset: 567:2938fc80591a
user:      Ryan C. Gordon <icculus at icculus.org>
date:      Wed Feb 07 15:43:51 2018 -0500
description:
pcx: don't overflow buffer if bytes-per-line is less than image width.

diffstat:

 IMG_pcx.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r f50c9c46ba52 -r 2938fc80591a IMG_pcx.c
--- a/IMG_pcx.c	Sun Jan 28 22:10:40 2018 -0800
+++ b/IMG_pcx.c	Wed Feb 07 15:43:51 2018 -0500
@@ -147,7 +147,7 @@
     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 */


More information about the commits mailing list