pnm: Don't get into infinite loops on truncated files.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 26 Sep 2018 15:19:34 -0400
changeset 58732a18ca05935
parent 586 19beb4a1bb54
child 588 960662a9dbdc
pnm: Don't get into infinite loops on truncated files.
IMG_pnm.c
     1.1 --- a/IMG_pnm.c	Wed Sep 26 15:19:17 2018 -0400
     1.2 +++ b/IMG_pnm.c	Wed Sep 26 15:19:34 2018 -0400
     1.3 @@ -73,7 +73,7 @@
     1.4      /* Skip leading whitespace */
     1.5      do {
     1.6          if ( ! SDL_RWread(src, &ch, 1, 1) ) {
     1.7 -            return(0);
     1.8 +            return(-1);
     1.9          }
    1.10          /* Eat comments as whitespace */
    1.11          if ( ch == '#' ) {  /* Comment is '#' to end of line */