~ubuntu-branches/debian/lenny/php5/lenny

« back to all changes in this revision

Viewing changes to debian/patches/CVE-2011-4566.patch

  • Committer: Package Import Robot
  • Author(s): Ondřej Surý
  • Date: 2012-02-03 09:01:31 UTC
  • Revision ID: package-import@ubuntu.com-20120203090131-51tphng5tf1bdpqp
Tags: 5.2.6.dfsg.1-1+lenny16
Fix UMR in php_register_variable_ex (pull from upstream SVN)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- /dev/null
 
2
+++ b/ext/exif/tests/bug60150.phpt
 
3
@@ -0,0 +1,21 @@
 
4
+--TEST--
 
5
+Bug #60150 (Integer overflow during the parsing of invalid exif header)
 
6
+--SKIPIF--
 
7
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
 
8
+--INI--
 
9
+output_handler=
 
10
+zlib.output_compression=0 
 
11
+--FILE--
 
12
+<?php
 
13
+$infile = dirname(__FILE__).'/bug60150.jpg';
 
14
+var_dump(exif_read_data($infile));
 
15
+?>
 
16
+===DONE===
 
17
+--EXPECTF--
 
18
+Warning: exif_read_data(bug60150.jpg): Process tag(x9003=DateTimeOri): Illegal pointer offset(x%x + x%x = x%x > x%x) in %s on line %d
 
19
+
 
20
+Warning: exif_read_data(bug60150.jpg): Error reading from file: got=x%x(=%d) != itemlen-%d=x%x(=%d) in %s on line %d
 
21
+
 
22
+Warning: exif_read_data(bug60150.jpg): Invalid JPEG file in %s on line %d
 
23
+bool(false)
 
24
+===DONE===
 
25
--- a/ext/exif/exif.c
 
26
+++ b/ext/exif/exif.c
 
27
@@ -2873,13 +2873,13 @@ static int exif_process_IFD_TAG(image_in
 
28
                offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel);
 
29
                /* If its bigger than 4 bytes, the dir entry contains an offset. */
 
30
                value_ptr = offset_base+offset_val;
 
31
-               if (offset_val+byte_count > IFDlength || value_ptr < dir_entry) {
 
32
+               if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry) {
 
33
                        /*
 
34
                        // It is important to check for IMAGE_FILETYPE_TIFF
 
35
                        // JPEG does not use absolute pointers instead its pointers are relative to the start
 
36
                        // of the TIFF header in APP1 section.
 
37
                        */
 
38
-                       if (offset_val+byte_count>ImageInfo->FileSize || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM && ImageInfo->FileType!=IMAGE_FILETYPE_JPEG)) {
 
39
+                       if (byte_count > ImageInfo->FileSize || offset_val>ImageInfo->FileSize-byte_count || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM && ImageInfo->FileType!=IMAGE_FILETYPE_JPEG)) {
 
40
                                if (value_ptr < dir_entry) {
 
41
                                        /* we can read this if offset_val > 0 */
 
42
                                        /* some files have their values in other parts of the file */