com php-src: Fixed bug #68398 msooxml matches too many archives: NEWS ext/fileinfo/data_file.c ext/fileinfo/magicdata.patch
ext/fileinfo/tests/68398.zip ext/fileinfo/test s/bug68398.phpt
| From: | Anatol Belski | Date: | Sat, 06 Dec 2014 19:51:00 +0000 |
| Subject: | com php-src: Fixed bug #68398 msooxml matches too many archives: NEWS ext/fileinfo/data_file.c ext/fileinfo/magicdata.patch ext/fileinfo/tests/68398.zip ext/fileinfo/test s/bug68398.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-83556@lists.php.net to get a copy of this message | ||
Commit: 41a2f7074dabe6e702d4ce300c86894bfae1d4b1
Author: Anatol Belski <ab@php.net> Sat, 6 Dec 2014 20:51:00 +0100
Parents: 0854fd8b8114faa5bc4fa1736292525a5ecdea8b
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=41a2f7074dabe6e702d4ce300c86894bfae1d4b1
Log:
Fixed bug #68398 msooxml matches too many archives
Bugs:
https://bugs.php.net/68398
Changed paths:
M NEWS
M ext/fileinfo/data_file.c
M ext/fileinfo/magicdata.patch
A ext/fileinfo/tests/68398.zip
A ext/fileinfo/tests/bug68398.phpt
Diff:
diff --git a/NEWS b/NEWS
index b499ca5..c4999e4 100644
--- a/NEWS
+++ b/NEWS
@@ -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 5b24670..813b57d 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 524d40b..3f593f7 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
new file mode 100644
index 0000000..2d02049
Binary files /dev/null and b/ext/fileinfo/tests/68398.zip differ
diff --git a/ext/fileinfo/tests/bug68398.phpt b/ext/fileinfo/tests/bug68398.phpt
new file mode 100644
index 0000000..78d3b89
--- /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+++
+