File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ PHP NEWS
16
16
17
17
- GD:
18
18
. Fixed bug #77943 (imageantialias($image, false); does not work). (cmb)
19
+ . Fixed bug #77973 (Uninitialized read in gdImageCreateFromXbm).
20
+ (CVE-2019-11038) (cmb)
19
21
20
22
- JSON:
21
23
. Fixed bug #77843 (Use after free with json serializer). (Nikita)
Original file line number Diff line number Diff line change @@ -136,7 +136,11 @@ gdImagePtr gdImageCreateFromXbm(FILE * fd)
136
136
}
137
137
h [3 ] = ch ;
138
138
}
139
- sscanf (h , "%x" , & b );
139
+ if (sscanf (h , "%x" , & b ) != 1 ) {
140
+ gd_error ("invalid XBM" );
141
+ gdImageDestroy (im );
142
+ return 0 ;
143
+ }
140
144
for (bit = 1 ; bit <= max_bit ; bit = bit << 1 ) {
141
145
gdImageSetPixel (im , x ++ , y , (b & bit ) ? 1 : 0 );
142
146
if (x == im -> sx ) {
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #77973 (Uninitialized read in gdImageCreateFromXbm)
3
+ --SKIPIF--
4
+ <?php
5
+ if (!extension_loaded ('gd ' )) die ("skip gd extension not available " );
6
+ if (!function_exists ('imagecreatefromxbm ' )) die ("skip imagecreatefromxbm not available " );
7
+ ?>
8
+ --FILE--
9
+ <?php
10
+ $ contents = hex2bin ("23646566696e6520776964746820320a23646566696e652068656967687420320a737461746963206368617220626974735b5d203d7b0a7a7a787a7a " );
11
+ $ filepath = __DIR__ . '/bug77973.xbm ' ;
12
+ file_put_contents ($ filepath , $ contents );
13
+ $ im = imagecreatefromxbm ($ filepath );
14
+ var_dump ($ im );
15
+ ?>
16
+ ===DONE===
17
+ --EXPECTF--
18
+ Warning: imagecreatefromxbm(): invalid XBM in %s on line %d
19
+
20
+ Warning: imagecreatefromxbm(): '%s' is not a valid XBM file in %s on line %d
21
+ bool(false)
22
+ ===DONE===
23
+ --CLEAN--
24
+ <?php
25
+ unlink (__DIR__ . '/bug77973.xbm ' );
26
+ ?>
You can’t perform that action at this time.
0 commit comments