diff options
author | Anatol Belski <ab@php.net> | 2014-04-24 19:30:34 +0200 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2014-07-18 15:48:18 -0700 |
commit | 0335d2ef3efbcb5f45e753a34fd7b74188997d87 (patch) | |
tree | a029b86451058f75f7e7d48af2a6f6dad03fb754 | |
parent | a0bb3fd6793fe16dbf4d3b5eb3413093088a6b37 (diff) | |
download | php-git-0335d2ef3efbcb5f45e753a34fd7b74188997d87.tar.gz |
Fixed bug #66307 Fileinfo crashes with powerpoint files
Conflicts:
ext/fileinfo/libmagic/readcdf.c
ext/fileinfo/tests/finfo_file_002.phpt
-rw-r--r-- | ext/fileinfo/libmagic/readcdf.c | 5 | ||||
-rw-r--r-- | ext/fileinfo/tests/finfo_file_002.phpt | 4 | ||||
-rw-r--r-- | ext/fileinfo/tests/resources/test.ppt | bin | 0 -> 99840 bytes |
3 files changed, 7 insertions, 2 deletions
diff --git a/ext/fileinfo/libmagic/readcdf.c b/ext/fileinfo/libmagic/readcdf.c index 0c28ffbfa8..dc6bcf094b 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); + c = cdf_ctime(&sec); 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 3593233c39..c3f8388659 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(7) { +array(8) { ["%s/resources/dir.zip"]=> string(15) "application/zip" ["%s/resources/test.awk"]=> @@ -33,4 +33,6 @@ array(7) { 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 Binary files differnew file mode 100644 index 0000000000..713004c03d --- /dev/null +++ b/ext/fileinfo/tests/resources/test.ppt |