[Commits] SDL_image: lbm: Don't overflow static colormap buffer.

libsdl.org revision control commits-owner at libsdl.org
Wed Jan 24 09:02:13 PST 2018


details:   https://hg.libsdl.org/SDL_image/rev/bfa08dc02b3c
changeset: 557:bfa08dc02b3c
user:      Ryan C. Gordon <icculus at icculus.org>
date:      Wed Jan 24 12:00:24 2018 -0500
description:
lbm: Don't overflow static colormap buffer.

diffstat:

 IMG_lbm.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r 97f7f01e0665 -r bfa08dc02b3c IMG_lbm.c
--- a/IMG_lbm.c	Wed Jan 24 01:45:04 2018 -0500
+++ b/IMG_lbm.c	Wed Jan 24 12:00:24 2018 -0500
@@ -183,6 +183,11 @@
 
         if ( !SDL_memcmp( id, "CMAP", 4 ) ) /* palette ( Color Map ) */
         {
+            if (size > sizeof (colormap)) {
+                error="colormap size is too large";
+                goto done;
+            }
+
             if ( !SDL_RWread( src, &colormap, size, 1 ) )
             {
                 error="error reading CMAP chunk";


More information about the commits mailing list