]> granicus.if.org Git - php/commitdiff
Fixed bug #68398 msooxml matches too many archives
authorAnatol Belski <ab@php.net>
Sat, 6 Dec 2014 19:51:00 +0000 (20:51 +0100)
committerAnatol Belski <ab@php.net>
Sat, 6 Dec 2014 19:51:00 +0000 (20:51 +0100)
NEWS
ext/fileinfo/data_file.c
ext/fileinfo/magicdata.patch
ext/fileinfo/tests/68398.zip [new file with mode: 0644]
ext/fileinfo/tests/bug68398.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index b499ca5986e16ee894c21209e97ffe415c5c2b7a..c4999e48f0ace17189d637ee4fd156a16623942c 100644 (file)
--- 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)
index 5b24670a729f93451fb08ff6812c3fba6b256878..813b57d725d4f7345c61f68bbcd9c46521d05716 100644 (file)
@@ -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, 
index 524d40b56782aa0e72e70ce1b8b754f2c8176cae..3f593f72ae522cd8521eef6a1661ef4de54abaea 100644 (file)
@@ -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 (file)
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 (file)
index 0000000..78d3b89
--- /dev/null
@@ -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+++
+