Skip to content

Commit 0335d2e

Browse files
weltlingsmalyshev
authored andcommitted
Fixed bug #66307 Fileinfo crashes with powerpoint files
Conflicts: ext/fileinfo/libmagic/readcdf.c ext/fileinfo/tests/finfo_file_002.phpt
1 parent a0bb3fd commit 0335d2e

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

ext/fileinfo/libmagic/readcdf.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
5656
const char *s;
5757
int len;
5858

59+
memset(&ts, 0, sizeof(ts));
60+
5961
for (i = 0; i < count; i++) {
6062
cdf_print_property_name(buf, sizeof(buf), info[i].pi_id);
6163
switch (info[i].pi_type) {
@@ -142,10 +144,11 @@ cdf_file_property_info(struct magic_set *ms, const cdf_property_info_t *info,
142144
return -1;
143145
} else {
144146
char *c, *ec;
147+
const time_t sec = ts.tv_sec;
145148
if (cdf_timestamp_to_timespec(&ts, tp) == -1) {
146149
return -1;
147150
}
148-
c = cdf_ctime(&ts.tv_sec);
151+
c = cdf_ctime(&sec);
149152
if ((ec = strchr(c, '\n')) != NULL)
150153
*ec = '\0';
151154

ext/fileinfo/tests/finfo_file_002.phpt

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ksort($results);
1818
var_dump($results);
1919
?>
2020
--EXPECTF--
21-
array(7) {
21+
array(8) {
2222
["%s/resources/dir.zip"]=>
2323
string(15) "application/zip"
2424
["%s/resources/test.awk"]=>
@@ -33,4 +33,6 @@ array(7) {
3333
string(15) "application/pdf"
3434
["%s/resources/test.png"]=>
3535
string(9) "image/png"
36+
["%s/resources/test.ppt"]=>
37+
string(29) "application/vnd.ms-powerpoint"
3638
}

ext/fileinfo/tests/resources/test.ppt

97.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)