xref: /PHP-7.0/ext/fileinfo/magicdata.patch (revision c9d0894e)
1Patches applied to file 5.17 sources tree before generating magic.mgc
2and before running create_data_file.php to create data_file.c.
3
4
5
6From 0b478f445b6b7540b58af5d1fe583fa9e48fd745 Mon Sep 17 00:00:00 2001
7From: Christos Zoulas <christos@zoulas.com>
8Date: Wed, 28 May 2014 19:52:36 +0000
9Subject: [PATCH] further optimize awk by not looking for the BEGIN regex until
10 we found the BEGIN (Jan Kaluza)
11
12---
13 magic/Magdir/commands | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/magic/Magdir/commands b/magic/Magdir/commands
17index bfffdef..26b2869 100644
18--- a/magic/Magdir/commands
19+++ b/magic/Magdir/commands
20@@ -49,7 +49,8 @@
21 !:mime	text/x-awk
22 0	string/wt	#!\ /usr/bin/awk	awk script text executable
23 !:mime	text/x-awk
24-0	regex		=^\\s{0,100}BEGIN\\s{0,100}[{]	awk script text
25+0       search/16384    BEGIN
26+>0	regex		=^\\s{0,100}BEGIN\\s{0,100}[{]	awk script text
27
28 # AT&T Bell Labs' Plan 9 shell
29 0	string/wt	#!\ /bin/rc	Plan 9 rc shell script text executable
30--
312.0.3
32
33From 71a8b6c0d758acb0f73e2e51421a711b5e9d6668 Mon Sep 17 00:00:00 2001
34From: Christos Zoulas <christos@zoulas.com>
35Date: Fri, 30 May 2014 16:48:44 +0000
36Subject: [PATCH] Limit regex search for BEGIN to the first 4K of the file.
37
38---
39 magic/Magdir/commands | 5 ++---
40 1 file changed, 2 insertions(+), 3 deletions(-)
41
42diff --git a/magic/Magdir/commands b/magic/Magdir/commands
43index 26b2869..bcd0f43 100644
44--- a/magic/Magdir/commands
45+++ b/magic/Magdir/commands
46@@ -49,8 +49,7 @@
47 !:mime	text/x-awk
48 0	string/wt	#!\ /usr/bin/awk	awk script text executable
49 !:mime	text/x-awk
50-0       search/16384    BEGIN
51->0	regex		=^\\s{0,100}BEGIN\\s{0,100}[{]	awk script text
52+0	regex/4096	=^\\s{0,100}BEGIN\\s{0,100}[{]	awk script text
53
54 # AT&T Bell Labs' Plan 9 shell
55 0	string/wt	#!\ /bin/rc	Plan 9 rc shell script text executable
56--
572.0.3
58
59From 71d04468a5777fe43064af02f06d74cb60feafab Mon Sep 17 00:00:00 2001
60From: =?UTF-8?q?Andreas=20K=C3=B6hler?= <andi5.py@gmx.net>
61Date: Sat, 14 Jun 2014 03:04:28 +0200
62Subject: [PATCH] Fix regex in msooxml to avoid matching other archives.
63
64---
65 magic/Magdir/msooxml | 2 +-
66 1 file changed, 1 insertion(+), 1 deletion(-)
67
68diff --git a/magic/Magdir/msooxml b/magic/Magdir/msooxml
69index c908b71..5ff3760 100644
70--- a/magic/Magdir/msooxml
71+++ b/magic/Magdir/msooxml
72@@ -16,7 +16,7 @@
73 0		string		PK\003\004
74 !:strength +10
75 # make sure the first file is correct
76->0x1E		regex		\[Content_Types\]\.xml|_rels/\.rels
77+>0x1E		regex		\\[Content_Types\\]\\.xml|_rels/\\.rels
78 # skip to the second local file header
79 # since some documents include a 520-byte extra field following the file
80 # header, we need to scan for the next header
81--
822.0.0
83
84From f2750e17d784dd6b21f7649965d2bd0605bfd471 Mon Sep 17 00:00:00 2001
85From: Christos Zoulas <christos@zoulas.com>
86Date: Tue, 25 Feb 2014 20:28:16 +0000
87Subject: [PATCH] comment out, too weak magic
88
89---
90 magic/Magdir/filesystems | 81 ++++++++++++++++++++++++------------------------
91 1 file changed, 41 insertions(+), 40 deletions(-)
92
93diff --git a/magic/Magdir/filesystems b/magic/Magdir/filesystems
94index 5624de0..a25e16a 100644
95--- a/magic/Magdir/filesystems
96+++ b/magic/Magdir/filesystems
97@@ -1,5 +1,5 @@
98 #------------------------------------------------------------------------------
99-# $File: filesystems,v 1.84 2013/10/24 15:51:07 christos Exp $
100+# $File: filesystems,v 1.85 2013/11/19 23:54:05 christos Exp $
101 # filesystems:  file(1) magic for different filesystems
102 #
103 0	name	partid
104@@ -1870,9 +1870,10 @@
105
106 # all FAT12 (strength=70) floppies with sectorsize 512 added by Joerg Jenderek at Jun 2013
107 # http://en.wikipedia.org/wiki/File_Allocation_Table#Exceptions
108-512		ubelong&0xE0ffff00	0xE0ffff00
109+# Too Weak.
110+#512		ubelong&0xE0ffff00	0xE0ffff00
111 # without valid Media descriptor in place of BPB, cases with are done at other places
112->21		ubyte			<0xE5			floppy with old FAT filesystem
113+#>21		ubyte			<0xE5			floppy with old FAT filesystem
114 # but valid Media descriptor at begin of FAT
115 #>>512		ubyte			=0xed			720k
116 #>>512		ubyte			=0xf0			1440k
117@@ -1880,64 +1881,64 @@
118 #>>512		ubyte			=0xf9			1220k
119 #>>512		ubyte			=0xfa			320k
120 #>>512		ubyte			=0xfb			640k
121->>512		ubyte			=0xfc			180k
122+#>>512		ubyte			=0xfc			180k
123 # look like an an old DOS directory entry
124->>>0xA0E	ubequad			0
125->>>>0xA00	ubequad			!0
126-!:mime application/x-ima
127->>512		ubyte			=0xfd
128+#>>>0xA0E	ubequad			0
129+#>>>>0xA00	ubequad			!0
130+#!:mime application/x-ima
131+#>>512		ubyte			=0xfd
132 # look for 2nd FAT at different location to distinguish between 360k and 500k
133->>>0x600	ubelong&0xE0ffff00	0xE0ffff00		360k
134+#>>>0x600	ubelong&0xE0ffff00	0xE0ffff00		360k
135 #>>>0x500	ubelong&0xE0ffff00	0xE0ffff00		500k
136->>>0xA0E	ubequad			0
137-!:mime application/x-ima
138->>512		ubyte			=0xfe
139->>>0x400	ubelong&0xE0ffff00	0xE0ffff00		160k
140->>>>0x60E	ubequad			0
141->>>>>0x600	ubequad			!0
142-!:mime application/x-ima
143+#>>>0xA0E	ubequad			0
144+#!:mime application/x-ima
145+#>>512		ubyte			=0xfe
146+#>>>0x400	ubelong&0xE0ffff00	0xE0ffff00		160k
147+#>>>>0x60E	ubequad			0
148+#>>>>>0x600	ubequad			!0
149+#!:mime application/x-ima
150 #>>>0xC00	ubelong&0xE0ffff00	0xE0ffff00		1200k
151->>512		ubyte			=0xff			320k
152->>>0x60E	ubequad			0
153->>>>0x600	ubequad			!0
154-!:mime application/x-ima
155->>512		ubyte			x			\b, Media descriptor 0x%x
156+#>>512		ubyte			=0xff			320k
157+#>>>0x60E	ubequad			0
158+#>>>>0x600	ubequad			!0
159+#!:mime application/x-ima
160+#>>512		ubyte			x			\b, Media descriptor 0x%x
161 # without x86 jump instruction
162->>0		ulelong&0x804000E9	!0x000000E9
163+#>>0		ulelong&0x804000E9	!0x000000E9
164 # assembler instructions: CLI;MOV SP,1E7;MOV AX;07c0;MOV
165->>>0	ubequad				0xfabce701b8c0078e	\b, MS-DOS 1.12 bootloader
166+#>>>0	ubequad				0xfabce701b8c0078e	\b, MS-DOS 1.12 bootloader
167 # IOSYS.COM+MSDOS.COM
168->>>>0xc4	use			2xDOS-filename
169->>0		ulelong&0x804000E9	=0x000000E9
170+#>>>>0xc4	use			2xDOS-filename
171+#>>0		ulelong&0x804000E9	=0x000000E9
172 # only x86 short jump instruction found
173->>>0		ubyte			=0xEB
174->>>>1		ubyte			x			\b, code offset 0x%x+2
175+#>>>0		ubyte			=0xEB
176+#>>>>1		ubyte			x			\b, code offset 0x%x+2
177 # http://thestarman.pcministry.com/DOS/ibm100/Boot.htm
178 # assembler instructions: CLI;MOV AX,CS;MOV DS,AX;MOV DX,0
179->>>>(1.b+2)	ubequad			0xfa8cc88ed8ba0000	\b, PC-DOS 1.0 bootloader
180+#>>>>(1.b+2)	ubequad			0xfa8cc88ed8ba0000	\b, PC-DOS 1.0 bootloader
181 # ibmbio.com+ibmdos.com
182->>>>>0x176	use			DOS-filename
183->>>>>0x181	ubyte			x			\b+
184->>>>>0x182	use			DOS-filename
185+#>>>>>0x176	use			DOS-filename
186+#>>>>>0x181	ubyte			x			\b+
187+#>>>>>0x182	use			DOS-filename
188 # http://thestarman.pcministry.com/DOS/ibm110/Boot.htm
189 # assembler instructions: CLI;MOV AX,CS;MOV DS,AX;XOR DX,DX;MOV
190->>>>(1.b+2)	ubequad			0xfa8cc88ed833d28e	\b, PC-DOS 1.1 bootloader
191+#>>>>(1.b+2)	ubequad			0xfa8cc88ed833d28e	\b, PC-DOS 1.1 bootloader
192 # ibmbio.com+ibmdos.com
193->>>>>0x18b	use			DOS-filename
194->>>>>0x196	ubyte			x			\b+
195->>>>>0x197	use			DOS-filename
196+#>>>>>0x18b	use			DOS-filename
197+#>>>>>0x196	ubyte			x			\b+
198+#>>>>>0x197	use			DOS-filename
199 # http://en.wikipedia.org/wiki/Zenith_Data_Systems
200 # assembler instructions: MOV BX,07c0;MOV SS,BX;MOV SP,01c6
201->>>>(1.b+2)	ubequad			0xbbc0078ed3bcc601	\b, Zenith Data Systems MS-DOS 1.25 bootloader
202+#>>>>(1.b+2)	ubequad			0xbbc0078ed3bcc601	\b, Zenith Data Systems MS-DOS 1.25 bootloader
203 # IO.SYS+MSDOS.SYS
204->>>>>0x20	use			2xDOS-filename
205+#>>>>>0x20	use			2xDOS-filename
206 # http://en.wikipedia.org/wiki/Corona_Data_Systems
207 # assembler instructions: MOV AX,CS;MOV DS,AX;CLI;MOV SS,AX;
208->>>>(1.b+2)	ubequad			0x8cc88ed8fa8ed0bc	\b, MS-DOS 1.25 bootloader
209+#>>>>(1.b+2)	ubequad			0x8cc88ed8fa8ed0bc	\b, MS-DOS 1.25 bootloader
210 # IO.SYS+MSDOS.SYS
211->>>>>0x69	use			2xDOS-filename
212+#>>>>>0x69	use			2xDOS-filename
213 # assembler instructions: CLI;PUSH CS;POP SS;MOV SP,7c00;
214->>>>(1.b+2)	ubequad			0xfa0e17bc007cb860	\b, MS-DOS 2.11 bootloader
215+#>>>>(1.b+2)	ubequad			0xfa0e17bc007cb860	\b, MS-DOS 2.11 bootloader
216 # defect IO.SYS+MSDOS.SYS ?
217 #>>>>>0x162	use			2xDOS-filename
218
219