components/gd2/patches/006-CVE-2014-9709.patch
author Stefan Teleman <stefan.teleman@oracle.com>
Wed, 15 Apr 2015 13:45:38 -0700
changeset 4131 2044271af6a1
permissions -rw-r--r--
20831561 problem in LIBRARY/GD2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4131
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     1
# External patch:
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     2
# https://bitbucket.org/libgd/gd-libgd/commits/47eb44b2e90ca88a08dca9f9a1aa9041e9587f43
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     3
# Backported to GD2 Version 2.0.35
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     4
--- gd_gif_in.c	2007-06-14 12:51:41.000000000 -0700
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     5
+++ gd_gif_in.c	2015-04-06 11:11:40.591453962 -0700
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     6
@@ -70,8 +70,10 @@
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     7
 
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     8
 #define STACK_SIZE ((1<<(MAX_LWZ_BITS))*2)
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     9
 
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    10
+#define CSD_BUF_SIZE 280
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    11
+
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    12
 typedef struct {
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    13
-	unsigned char    buf[280];
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    14
+	unsigned char    buf[CSD_BUF_SIZE];
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    15
 	int              curbit, lastbit, done, last_byte;
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    16
 } CODE_STATIC_DATA;
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    17
 
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    18
@@ -380,8 +382,14 @@
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    19
        }
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    20
 
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    21
        ret = 0;
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    22
-       for (i = scd->curbit, j = 0; j < code_size; ++i, ++j)
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    23
+       for (i = scd->curbit, j = 0; j < code_size; ++i, ++j) {
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    24
+         if (i < CSD_BUF_SIZE * 8) {
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    25
                ret |= ((scd->buf[ i / 8 ] & (1 << (i % 8))) != 0) << j;
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    26
+         } else {
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    27
+           ret = -1;
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    28
+           break;
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    29
+         }
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    30
+       }
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    31
 
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    32
        scd->curbit += code_size;
2044271af6a1 20831561 problem in LIBRARY/GD2
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    33
        return ret;