pajoye                                   Thu, 01 Oct 2009 13:55:16 +0000

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

Log:
- fix #49732, fix crash when timestamp conversion fails

Bug: http://bugs.php.net/49732 (Open) PHP crashes when using finfo_file() to 
get mime info with this file (included)
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/readcdf.c
    U   php/php-src/trunk/ext/fileinfo/libmagic/readcdf.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-10-01 10:55:19 UTC (rev 289048)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-10-01 13:55:16 UTC (rev 289049)
@@ -12,6 +12,9 @@
   (Rasmus)
 - Fixed a open_basedir bypass in posix_mkfifo() identified by Grzegorz
   Stachowiak.  (Rasmus)
+
+- Fixed bug #49732 (crashes when using fileinfo when timestamp conversion
+  fails). (Pierre)
 - Fixed bug #49698 (Unexpected change in strnatcasecmp()). (Rasmus)
 - Fixed bug #49647 (DOMUserData does not exist). (Rob)
 - Fixed bug #49630 (imap_listscan function missing). (Felipe)
@@ -21,7 +24,8 @@
   fclose). (Ilia)
 - Fixed bug #48805 (IPv6 socket transport is not working). (Ilia)

-?? ??? 2009, PHP 5.3.1RC? <- WHY IS THIS HERE? Gonna be released after 5.3.1 
or what??
+
+?? ??? 2009, PHP 5.3.1RC? < WILL BE MERGED LATER
 - Upgraded bundled sqlite to version 3.6.18. (Ilia)
 - Restored shebang line check to CGI sapi (not checked by scanner anymore).
   (Jani)

Modified: php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/readcdf.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/readcdf.c        
2009-10-01 10:55:19 UTC (rev 289048)
+++ php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/readcdf.c        
2009-10-01 13:55:16 UTC (rev 289049)
@@ -125,7 +125,10 @@
                                                return -1;
                                } else {
                                        char *c, *ec;
-                                       cdf_timestamp_to_timespec(&ts, tp);
+
+                                       if (cdf_timestamp_to_timespec(&ts, tp) 
== -1) {
+                                               return -1;
+                                       }
                                        c = ctime(&ts.tv_sec);
                                        if ((ec = strchr(c, '\n')) != NULL)
                                                *ec = '\0';

Modified: php/php-src/trunk/ext/fileinfo/libmagic/readcdf.c
===================================================================
--- php/php-src/trunk/ext/fileinfo/libmagic/readcdf.c   2009-10-01 10:55:19 UTC 
(rev 289048)
+++ php/php-src/trunk/ext/fileinfo/libmagic/readcdf.c   2009-10-01 13:55:16 UTC 
(rev 289049)
@@ -123,7 +123,10 @@
                                                return -1;
                                } else {
                                        char *c, *ec;
-                                       cdf_timestamp_to_timespec(&ts, tp);
+
+                                       if (cdf_timestamp_to_timespec(&ts, tp) 
== -1) {
+                                               return -1;
+                                       }
                                        c = ctime(&ts.tv_sec);
                                        if ((ec = strchr(c, '\n')) != NULL)
                                                *ec = '\0';

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

Reply via email to