com php-src: Fixed bug #66307 Fileinfo crashes with powerpoint files: NEWS ext/fileinfo/libmagic/readcdf.c ext/fileinfo/tests/finfo_file _002.phpt
ext/fileinfo/tests/resources/test.ppt

From: Date: Thu, 24 Apr 2014 17:30:34 +0000
Subject: com php-src: Fixed bug #66307 Fileinfo crashes with powerpoint files: NEWS ext/fileinfo/libmagic/readcdf.c ext/fileinfo/tests/finfo_file _002.phpt
ext/fileinfo/tests/resources/test.ppt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-77133@lists.php.net to get a copy of this message
Commit: 03fa5501a84af2bda7d81c732d46d2a68ee0e855 Author: Anatol Belski <ab@php.net> Thu, 24 Apr 2014 19:30:34 +0200 Parents: acfed1c4c71f25603e90f9df3930c294e5ae0726 Branches: PHP-5.5 PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=03fa5501a84af2bda7d81c732d46d2a68ee0e855 Log: Fixed bug #66307 Fileinfo crashes with powerpoint files Bugs: https://bugs.php.net/66307 Changed paths: M NEWS M ext/fileinfo/libmagic/readcdf.c M ext/fileinfo/tests/finfo_file_002.phpt A ext/fileinfo/tests/resources/test.ppt Diff: diff --git a/NEWS b/NEWS index ca0617c..f1c0394 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,9 @@ PHP NEWS . Fixed bug #67081 (DOMDocumentType->internalSubset returns entire DOCTYPE tag, not only the subset). (Anatol) +- Fileinfo: + . Fixed bug #66307 (Fileinfo crashes with powerpoint files). (Anatol) + - FPM: . Fixed bug #66908 (php-fpm reload leaks epoll_create() file descriptor). (Julio Pintos) diff --git a/ext/fileinfo/libmagic/readcdf.c b/ext/fileinfo/libmagic/readcdf.c index 3abcc2e..ade10b2 100644 --- a/ext/fileinfo/libmagic/readcdf.c +++ b/ext/fileinfo/libmagic/readcdf.c @@ -56,6 +56,8 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info, const char *s; int len; + memset(&ts, 0, sizeof(ts)); + for (i = 0; i < count; i++) { cdf_print_property_name(buf, sizeof(buf), info[i].pi_id); switch (info[i].pi_type) { @@ -142,10 +144,11 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info, return -1; } else { char *c, *ec; + const time_t sec = ts.tv_sec; if (cdf_timestamp_to_timespec(&ts, tp) == -1) { return -1; } - c = cdf_ctime(&ts.tv_sec, tbuf); + c = cdf_ctime(&sec, tbuf); if ((ec = strchr(c, '\n')) != NULL) *ec = '\0'; diff --git a/ext/fileinfo/tests/finfo_file_002.phpt b/ext/fileinfo/tests/finfo_file_002.phpt index feb4010..5cce7f3 100644 --- a/ext/fileinfo/tests/finfo_file_002.phpt +++ b/ext/fileinfo/tests/finfo_file_002.phpt @@ -18,7 +18,7 @@ ksort($results); var_dump($results); ?> --EXPECTF-- -array(8) { +array(9) { ["%s/resources/dir.zip"]=> string(15) "application/zip" ["%s/resources/test.awk"]=> @@ -35,4 +35,6 @@ array(8) { string(15) "application/pdf" ["%s/resources/test.png"]=> string(9) "image/png" + ["%s/resources/test.ppt"]=> + string(29) "application/vnd.ms-powerpoint" } diff --git a/ext/fileinfo/tests/resources/test.ppt b/ext/fileinfo/tests/resources/test.ppt new file mode 100644 index 0000000..713004c Binary files /dev/null and b/ext/fileinfo/tests/resources/test.ppt differ

« previous php.cvs (#77133) next »