diff options
author | Anatol Belski <ab@php.net> | 2014-12-06 20:51:00 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-12-06 20:51:00 +0100 |
commit | 41a2f7074dabe6e702d4ce300c86894bfae1d4b1 (patch) | |
tree | 4325310fdf594716cf924b3c48e43ad1f53f4203 | |
parent | 0854fd8b8114faa5bc4fa1736292525a5ecdea8b (diff) | |
download | php-git-41a2f7074dabe6e702d4ce300c86894bfae1d4b1.tar.gz |
Fixed bug #68398 msooxml matches too many archives
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/fileinfo/data_file.c | 8 | ||||
-rw-r--r-- | ext/fileinfo/magicdata.patch | 25 | ||||
-rw-r--r-- | ext/fileinfo/tests/68398.zip | bin | 0 -> 356 bytes | |||
-rw-r--r-- | ext/fileinfo/tests/bug68398.phpt | 15 |
5 files changed, 47 insertions, 4 deletions
@@ -21,6 +21,9 @@ PHP NEWS . Implemented FR #68268 (DatePeriod: Getter for start date, end date and interval). (Marc Bennewitz) +- Fileinfo: + . Fixed bug #68398 (msooxml matches too many archives). (Anatol) + - mbstring: . Fixed bug #68504 (--with-libmbfl configure option not present on Windows). (Ashesh Vashi) diff --git a/ext/fileinfo/data_file.c b/ext/fileinfo/data_file.c index 5b24670a72..813b57d725 100644 --- a/ext/fileinfo/data_file.c +++ b/ext/fileinfo/data_file.c @@ -48144,11 +48144,11 @@ const unsigned char php_magic_database[2803888] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x01, 0x00, 0x00, 0x00, 0x3D, 0x1F, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, +0x01, 0x00, 0x00, 0x00, 0x3D, 0x23, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x5B, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x5F, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5D, 0x2E, -0x78, 0x6D, 0x6C, 0x7C, 0x5F, 0x72, 0x65, 0x6C, 0x73, 0x2F, 0x2E, 0x72, 0x65, 0x6C, 0x73, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x5C, 0x5B, 0x43, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x74, 0x5F, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5C, +0x5D, 0x5C, 0x2E, 0x78, 0x6D, 0x6C, 0x7C, 0x5F, 0x72, 0x65, 0x6C, 0x73, 0x2F, 0x5C, 0x2E, 0x72, +0x65, 0x6C, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/ext/fileinfo/magicdata.patch b/ext/fileinfo/magicdata.patch index 524d40b567..3f593f72ae 100644 --- a/ext/fileinfo/magicdata.patch +++ b/ext/fileinfo/magicdata.patch @@ -56,3 +56,28 @@ index 26b2869..bcd0f43 100644 -- 2.0.3 +From 71d04468a5777fe43064af02f06d74cb60feafab Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20K=C3=B6hler?= <andi5.py@gmx.net> +Date: Sat, 14 Jun 2014 03:04:28 +0200 +Subject: [PATCH] Fix regex in msooxml to avoid matching other archives. + +--- + magic/Magdir/msooxml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/magic/Magdir/msooxml b/magic/Magdir/msooxml +index c908b71..5ff3760 100644 +--- a/magic/Magdir/msooxml ++++ b/magic/Magdir/msooxml +@@ -16,7 +16,7 @@ + 0 string PK\003\004 + !:strength +10 + # make sure the first file is correct +->0x1E regex \[Content_Types\]\.xml|_rels/\.rels ++>0x1E regex \\[Content_Types\\]\\.xml|_rels/\\.rels + # skip to the second local file header + # since some documents include a 520-byte extra field following the file + # header, we need to scan for the next header +-- +2.0.0 + diff --git a/ext/fileinfo/tests/68398.zip b/ext/fileinfo/tests/68398.zip Binary files differnew file mode 100644 index 0000000000..2d0204977b --- /dev/null +++ b/ext/fileinfo/tests/68398.zip diff --git a/ext/fileinfo/tests/bug68398.phpt b/ext/fileinfo/tests/bug68398.phpt new file mode 100644 index 0000000000..78d3b8929f --- /dev/null +++ b/ext/fileinfo/tests/bug68398.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #68398: msooxml matches too many archives +--SKIPIF-- +<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> +--FILE-- +<?php + +$f = new finfo(FILEINFO_MIME); +var_dump($f->file(dirname(__FILE__) . DIRECTORY_SEPARATOR . '68398.zip')); +?> ++++DONE+++ +--EXPECTF-- +string(31) "application/zip; charset=binary" ++++DONE+++ + |