scottmac                                 Fri, 13 May 2011 05:06:48 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=310980

Log:
Fixed bug #54723 - getimagesize() doesn't check the full ico signature and 
misreports mpg files

Bug: http://bugs.php.net/54723 (Open) getimagesize() incorrectly identifies 
files as ICO which aren't
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/standard/image.c
    U   php/php-src/trunk/ext/standard/image.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-05-13 03:50:23 UTC (rev 310979)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-05-13 05:06:48 UTC (rev 310980)
@@ -19,6 +19,8 @@
   . Implemented FR #54459 (Range function accuracy). (Adam)
   . Added PHP_MANDIR constant telling where the manpages were installed into,
     and an --man-dir argument to php-config. (Hannes)
+  . Fixed bug #54723 (getimagesize() doesn't check the full ico signature).
+    (Scott)
   . Fixed bug #54580 (get_browser() segmentation fault when browscap ini
     directive is set through php_admin_value). (Gustavo)
   . Fixed bug #54238 (use-after-free in substr_replace()). (Stas)

Modified: php/php-src/branches/PHP_5_3/ext/standard/image.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/image.c   2011-05-13 03:50:23 UTC 
(rev 310979)
+++ php/php-src/branches/PHP_5_3/ext/standard/image.c   2011-05-13 05:06:48 UTC 
(rev 310980)
@@ -51,7 +51,7 @@
                                      (char)0x6a, (char)0x50, (char)0x20, 
(char)0x20,
                                      (char)0x0d, (char)0x0a, (char)0x87, 
(char)0x0a};
 PHPAPI const char php_sig_iff[4] = {'F','O','R','M'};
-PHPAPI const char php_sig_ico[3] = {(char)0x00, (char)0x00, (char)0x01};
+PHPAPI const char php_sig_ico[4] = {(char)0x00, (char)0x00, (char)0x01, 
(char)0x00};

 /* REMEMBER TO ADD MIME-TYPE TO FUNCTION php_image_type_to_mime_type */
 /* PCX must check first 64bytes and byte 0=0x0a and byte2 < 0x06 */
@@ -1265,7 +1265,7 @@
                return IMAGE_FILETYPE_TIFF_MM;
        } else if (!memcmp(filetype, php_sig_iff, 4)) {
                return IMAGE_FILETYPE_IFF;
-       } else if (!memcmp(filetype, php_sig_ico, 3)) {
+       } else if (!memcmp(filetype, php_sig_ico, 4)) {
                return IMAGE_FILETYPE_ICO;
        }


Modified: php/php-src/trunk/ext/standard/image.c
===================================================================
--- php/php-src/trunk/ext/standard/image.c      2011-05-13 03:50:23 UTC (rev 
310979)
+++ php/php-src/trunk/ext/standard/image.c      2011-05-13 05:06:48 UTC (rev 
310980)
@@ -51,7 +51,7 @@
                                      (char)0x6a, (char)0x50, (char)0x20, 
(char)0x20,
                                      (char)0x0d, (char)0x0a, (char)0x87, 
(char)0x0a};
 PHPAPI const char php_sig_iff[4] = {'F','O','R','M'};
-PHPAPI const char php_sig_ico[3] = {(char)0x00, (char)0x00, (char)0x01};
+PHPAPI const char php_sig_ico[4] = {(char)0x00, (char)0x00, (char)0x01, 
(char)0x00};

 /* REMEMBER TO ADD MIME-TYPE TO FUNCTION php_image_type_to_mime_type */
 /* PCX must check first 64bytes and byte 0=0x0a and byte2 < 0x06 */
@@ -1265,7 +1265,7 @@
                return IMAGE_FILETYPE_TIFF_MM;
        } else if (!memcmp(filetype, php_sig_iff, 4)) {
                return IMAGE_FILETYPE_IFF;
-       } else if (!memcmp(filetype, php_sig_ico, 3)) {
+       } else if (!memcmp(filetype, php_sig_ico, 4)) {
                return IMAGE_FILETYPE_ICO;
        }


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to