From f963e5cc8744ec09fefecce5f512993614b245f4 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 26 Sep 2018 15:19:34 -0400 Subject: [PATCH] pnm: Don't get into infinite loops on truncated files. --- IMG_pnm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IMG_pnm.c b/IMG_pnm.c index 0450d9e9..4c3707ec 100644 --- a/IMG_pnm.c +++ b/IMG_pnm.c @@ -73,7 +73,7 @@ static int ReadNumber(SDL_RWops *src) /* Skip leading whitespace */ do { if ( ! SDL_RWread(src, &ch, 1, 1) ) { - return(0); + return(-1); } /* Eat comments as whitespace */ if ( ch == '#' ) { /* Comment is '#' to end of line */