aboutsummaryrefslogtreecommitdiffstats
path: root/main/sdl2_image/CVE-2017-14440.patch
blob: 49ab2b032358cbcfdb6b3060b624a30f8e0392b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# HG changeset patch
# User Ryan C. Gordon <icculus@icculus.org>
# Date 1516813224 18000
# Node ID bfa08dc02b3c7b265ead6019f901f17f925570c3
# Parent  97f7f01e0665b7555a0e5e9465799e80c8f59528
lbm: Don't overflow static colormap buffer.

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";