[Commits] SDL_image: commit cc8b433532d9997081f1b9e7590ce8c90996e5be

libsdl.org revision control commits-owner at libsdl.org
Fri Sep 28 20:57:00 PDT 2018


details:   https://hg.libsdl.org/SDL_image/rev/90a531f221f2
changeset: 591:90a531f221f2
user:      Sam Lantinga <slouken at libsdl.org>
date:      Fri Sep 28 20:56:50 2018 -0700
description:
commit cc8b433532d9997081f1b9e7590ce8c90996e5be
Author: Michał Janiszewski <janisozaur+signed at gmail.com>
Date:   Fri Sep 28 20:52:21 2018 +0200

    PNM: Improve checks when loading a file

diffstat:

 IMG_pnm.c |  7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diffs (18 lines):

diff -r 8b4ee1d72a2a -r 90a531f221f2 IMG_pnm.c
--- a/IMG_pnm.c	Wed Sep 26 22:53:30 2018 +0200
+++ b/IMG_pnm.c	Fri Sep 28 20:56:50 2018 -0700
@@ -86,7 +86,14 @@
     } 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';
 


More information about the commits mailing list