Skip to content

Commit 34fa65a

Browse files
committedSep 18, 2022
fileinfo: magic: Backport mime type support for woff/woff2 fonts
Upstream patch: file/file@7a821ae Fixes GH-8805. Signed-off-by: Anatol Belski <ab@php.net> (cherry picked from commit 8a2ebe069148909a00739c83e9bcc031734bf826)
1 parent bfb4ee7 commit 34fa65a

File tree

6 files changed

+32
-9
lines changed

6 files changed

+32
-9
lines changed
 

‎ext/fileinfo/data_file.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -184490,7 +184490,7 @@ const unsigned char php_magic_database[7015032] = {
184490184490
0x72, 0x6D, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184491184491
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184492184492
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184493-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184493+
0x66, 0x6F, 0x6E, 0x74, 0x2F, 0x77, 0x6F, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184494184494
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184495184495
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184496184496
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -184500,7 +184500,7 @@ const unsigned char php_magic_database[7015032] = {
184500184500
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184501184501
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184502184502
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3D, 0x04, 0x2E, 0x00,
184503-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x01, 0x00, 0x00,
184503+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x01, 0x00, 0x00,
184504184504
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x6F, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
184505184505
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184506184506
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -184524,7 +184524,7 @@ const unsigned char php_magic_database[7015032] = {
184524184524
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184525184525
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184526184526
0x01, 0x00, 0x10, 0x00, 0x78, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
184527-
0x00, 0x00, 0x00, 0x00, 0x84, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184527+
0x00, 0x00, 0x00, 0x00, 0x85, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184528184528
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184529184529
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184530184530
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -184547,7 +184547,7 @@ const unsigned char php_magic_database[7015032] = {
184547184547
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184548184548
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184549184549
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x78, 0x00, 0x07, 0x00,
184550-
0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x01, 0x00, 0x00,
184550+
0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x01, 0x00, 0x00,
184551184551
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184552184552
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184553184553
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -184571,7 +184571,7 @@ const unsigned char php_magic_database[7015032] = {
184571184571
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184572184572
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184573184573
0x00, 0x00, 0x20, 0x00, 0x3D, 0x04, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184574-
0x00, 0x00, 0x00, 0x00, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184574+
0x00, 0x00, 0x00, 0x00, 0x88, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184575184575
0x77, 0x4F, 0x46, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184576184576
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184577184577
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -184584,7 +184584,7 @@ const unsigned char php_magic_database[7015032] = {
184584184584
0x72, 0x6D, 0x61, 0x74, 0x20, 0x28, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x20, 0x32, 0x29,
184585184585
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184586184586
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184587-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184587+
0x66, 0x6F, 0x6E, 0x74, 0x2F, 0x77, 0x6F, 0x66, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184588184588
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184589184589
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184590184590
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -184594,7 +184594,7 @@ const unsigned char php_magic_database[7015032] = {
184594184594
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184595184595
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184596184596
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3D, 0x04, 0x2E, 0x00,
184597-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x01, 0x00, 0x00,
184597+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0x01, 0x00, 0x00,
184598184598
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x6F, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
184599184599
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184600184600
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -184618,7 +184618,7 @@ const unsigned char php_magic_database[7015032] = {
184618184618
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184619184619
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184620184620
0x01, 0x00, 0x10, 0x00, 0x78, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
184621-
0x00, 0x00, 0x00, 0x00, 0x8A, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184621+
0x00, 0x00, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184622184622
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184623184623
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184624184624
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -184641,7 +184641,7 @@ const unsigned char php_magic_database[7015032] = {
184641184641
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184642184642
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184643184643
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x78, 0x00, 0x07, 0x00,
184644-
0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x01, 0x00, 0x00,
184644+
0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8D, 0x01, 0x00, 0x00,
184645184645
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184646184646
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184647184647
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

‎ext/fileinfo/magicdata.patch

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
diff -ur Magdir.orig/fonts Magdir/fonts
2+
--- Magdir.orig/fonts 2021-02-23 01:49:24.000000000 +0100
3+
+++ Magdir/fonts 2022-09-18 14:07:14.233023271 +0200
4+
@@ -384,11 +384,13 @@
5+
6+
# https://www.w3.org/TR/WOFF/
7+
0 string wOFF Web Open Font Format
8+
+!:mime font/woff
9+
>0 use woff
10+
>20 beshort x \b, version %d
11+
>22 beshort x \b.%d
12+
# https://www.w3.org/TR/WOFF2/
13+
0 string wOF2 Web Open Font Format (Version 2)
14+
+!:mime font/woff2
15+
>0 use woff
16+
#>20 belong x \b, totalCompressedSize %d
17+
>24 beshort x \b, version %d
118
diff -ur Magdir.orig/mail.news Magdir/mail.news
219
--- Magdir.orig/mail.news 2021-03-31 01:47:28.000000000 +0200
320
+++ Magdir/mail.news 2021-04-05 19:41:55.168556972 +0200

‎ext/fileinfo/tests/finfo_file_002.phpt

+2
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ array(%d) {
4343
string(11) "image/x-tga"
4444
["%s/resources/test.webm"]=>
4545
string(10) "video/webm"
46+
["%s/resources/test.woff"]=>
47+
string(9) "font/woff"
4648
}

‎ext/fileinfo/tests/magic

+2
Original file line numberDiff line numberDiff line change
@@ -14125,11 +14125,13 @@
1412514125

1412614126
# https://www.w3.org/TR/WOFF/
1412714127
0 string wOFF Web Open Font Format
14128+
!:mime font/woff
1412814129
>0 use woff
1412914130
>20 beshort x \b, version %d
1413014131
>22 beshort x \b.%d
1413114132
# https://www.w3.org/TR/WOFF2/
1413214133
0 string wOF2 Web Open Font Format (Version 2)
14134+
!:mime font/woff2
1413314135
>0 use woff
1413414136
#>20 belong x \b, totalCompressedSize %d
1413514137
>24 beshort x \b, version %d

‎ext/fileinfo/tests/magic私はガラスを食べられます

+2
Original file line numberDiff line numberDiff line change
@@ -14125,11 +14125,13 @@
1412514125

1412614126
# https://www.w3.org/TR/WOFF/
1412714127
0 string wOFF Web Open Font Format
14128+
!:mime font/woff
1412814129
>0 use woff
1412914130
>20 beshort x \b, version %d
1413014131
>22 beshort x \b.%d
1413114132
# https://www.w3.org/TR/WOFF2/
1413214133
0 string wOF2 Web Open Font Format (Version 2)
14134+
!:mime font/woff2
1413314135
>0 use woff
1413414136
#>20 belong x \b, totalCompressedSize %d
1413514137
>24 beshort x \b, version %d
1.23 KB
Binary file not shown.

0 commit comments

Comments
 (0)
Failed to load comments.