Navigation Menu

Skip to content

Commit

Permalink
commit cc8b433532d9997081f1b9e7590ce8c90996e5be
Browse files Browse the repository at this point in the history
Author: Micha? Janiszewski <janisozaur+signed@gmail.com>
Date:   Fri Sep 28 20:52:21 2018 +0200

    PNM: Improve checks when loading a file
  • Loading branch information
slouken committed Sep 29, 2018
1 parent 0596ee9 commit b8a008d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions IMG_pnm.c
Expand Up @@ -86,7 +86,14 @@ static int ReadNumber(SDL_RWops *src)
} while ( SDL_isspace(ch) );

/* Add up the number */
if (!SDL_isdigit(ch)) {
return -1;
}
do {
/* Protect from possible overflow */
if (number >= INT32_MAX / 10) {
return -1;
}
number *= 10;
number += ch-'0';

Expand Down

0 comments on commit b8a008d

Please sign in to comment.