From 802a9ecaad2cebb18223ba69d6570069725c6a0d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 10 Jun 2019 13:12:46 -0700 Subject: [PATCH] Fixed TALOS-2019-0821, reading invalid data from the file when bpl is -1 --- IMG_pcx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMG_pcx.c b/IMG_pcx.c index bd30645f..e4abdc12 100644 --- a/IMG_pcx.c +++ b/IMG_pcx.c @@ -160,7 +160,7 @@ SDL_Surface *IMG_LoadPCX_RW(SDL_RWops *src) goto done; bpl = pcxh.NPlanes * pcxh.BytesPerLine; - if ( bpl > surface->pitch ) { + if ( bpl < 0 || bpl > surface->pitch ) { error = "bytes per line is too large (corrupt?)"; goto done; }