Fixed TALOS-2019-0821, reading invalid data from the file when bpl is -1
authorSam Lantinga <slouken@libsdl.org>
Mon, 10 Jun 2019 13:12:46 -0700
changeset 643b920be2b3fc6
parent 642 7453e79c8cdb
child 644 5112afb71c02
Fixed TALOS-2019-0821, reading invalid data from the file when bpl is -1
IMG_pcx.c
     1.1 --- a/IMG_pcx.c	Mon Jun 10 13:07:58 2019 -0700
     1.2 +++ b/IMG_pcx.c	Mon Jun 10 13:12:46 2019 -0700
     1.3 @@ -160,7 +160,7 @@
     1.4          goto done;
     1.5  
     1.6      bpl = pcxh.NPlanes * pcxh.BytesPerLine;
     1.7 -    if ( bpl > surface->pitch ) {
     1.8 +    if ( bpl < 0 || bpl > surface->pitch ) {
     1.9          error = "bytes per line is too large (corrupt?)";
    1.10          goto done;
    1.11      }