1
0
mirror of https://github.com/php/php-src.git synced 2026-04-14 19:41:05 +02:00
Files
archived-php-src/ext/fileinfo/magicdata.patch
Joshua Westerheide 855bbc88c9 Fix #78183: finfo_file shows wrong mime-type for .tga file
Due to a bug in the underlying libmagic 5.31, .tga images returned mime type "image/x-tgaimage/x-tga".
2019-06-29 13:24:52 +02:00

221 lines
6.3 KiB
Diff

diff --git a/magic/Magdir/rpm b/magic/Magdir/rpm
index 9a795f8..31db083 100644
--- a/magic/Magdir/rpm
+++ b/magic/Magdir/rpm
@@ -29,6 +29,7 @@
>>8 beshort 17 SuperH
>>8 beshort 18 Xtensa
>>8 beshort 255 noarch
+>>10 string x %s
#delta RPM Daniel Novotny (dnovotny@redhat.com)
0 string drpm Delta RPM
diff --git a/magic/Magdir/securitycerts b/magic/Magdir/securitycerts
index 8785dd8..1c340be 100644
--- a/magic/Magdir/securitycerts
+++ b/magic/Magdir/securitycerts
@@ -4,3 +4,5 @@
0 search/1 -----BEGIN\ CERTIFICATE------ RFC1421 Security Certificate text
0 search/1 -----BEGIN\ NEW\ CERTIFICATE RFC1421 Security Certificate Signing Request text
0 belong 0xedfeedfe Sun 'jks' Java Keystore File data
+
+0 string \0volume_key volume_key escrow packet
From 898f5d27b66b5d5592cb56fa9da5b776628ea6ca Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Wed, 31 May 2017 15:48:50 +0000
Subject: [PATCH] Fix \s vs \w confusion.
Upstream commit: https://github.com/file/file/commit/898f5d27b66b5d5592cb56fa9da5b776628ea6ca
Fixes awk/perl script recognition
Signed-off-by: Marek Cermak <macermak@redhat.com>
---
magic/Magdir/commands | 4 ++--
magic/Magdir/images | 14 +++++++-------
magic/Magdir/python | 4 ++--
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/magic/Magdir/commands b/magic/Magdir/commands
index 1a46efd8..f4326a9e 100644
--- a/magic/Magdir/commands
+++ b/magic/Magdir/commands
@@ -56,7 +56,7 @@
!:mime text/x-awk
0 string/wt #!\ /usr/bin/awk awk script text executable
!:mime text/x-awk
-0 regex/4096 =^[A-Za-z0-9_]{0,100}BEGIN[A-Za-z0-9_]{0,100}[{] awk or perl script text
+0 regex/4096 =^[\040\t\f\r\n]{0,100}BEGIN[\040\t\f\r\n]{0,100}[{] awk or perl script text
# AT&T Bell Labs' Plan 9 shell
0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable
diff --git a/magic/Magdir/images b/magic/Magdir/images
index ce68e00d..d14c1de1 100644
--- a/magic/Magdir/images
+++ b/magic/Magdir/images
@@ -175,42 +175,42 @@
>>>&0 regex =[0-9]{1,50} \b %s
0 search/1 P1
->0 regex/4 P1[A-Za-z0-9_]
+>0 regex/4 P1[\040\t\f\r\n]
>>0 use netpbm
>>>0 string x \b, bitmap
!:strength + 45
!:mime image/x-portable-bitmap
0 search/1 P2
->0 regex/4 P2[A-Za-z0-9_]
+>0 regex/4 P2[\040\t\f\r\n]
>>0 use netpbm
>>>0 string x \b, greymap
!:strength + 45
!:mime image/x-portable-greymap
0 search/1 P3
->0 regex/4 P3[A-Za-z0-9_]
+>0 regex/4 P3[\040\t\f\r\n]
>>0 use netpbm
>>>0 string x \b, pixmap
!:strength + 45
!:mime image/x-portable-pixmap
0 string P4
->0 regex/4 P4[A-Za-z0-9_]
+>0 regex/4 P4[\040\t\f\r\n]
>>0 use netpbm
>>>0 string x \b, rawbits, bitmap
!:strength + 45
!:mime image/x-portable-bitmap
0 string P5
->0 regex/4 P5[A-Za-z0-9_]
+>0 regex/4 P5[\040\t\f\r\n]
>>0 use netpbm
>>>0 string x \b, rawbits, greymap
!:strength + 45
!:mime image/x-portable-greymap
0 string P6
->0 regex/4 P6[A-Za-z0-9_]
+>0 regex/4 P6[\040\t\f\r\n]
>>0 use netpbm
>>>0 string x \b, rawbits, pixmap
!:strength + 45
diff --git a/magic/Magdir/python b/magic/Magdir/python
index 81d1cc39..d6c2220a 100644
--- a/magic/Magdir/python
+++ b/magic/Magdir/python
@@ -64,7 +64,7 @@
# except: or finally:
# block
0 search/4096 try:
->&0 regex \^[A-Za-z0-9_]*except.*: Python script text executable
+>&0 regex \^[\040\t\f\r\n]*except.*: Python script text executable
!:strength + 15
!:mime text/x-python
>&0 search/4096 finally: Python script text executable
--
2.13.3
From 2e5e9e16a4847b2e60cabc70e6b9bd7d633cb68a Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Sat, 22 Jul 2017 17:21:24 +0000
Subject: [PATCH] Strength decreased in magic file magic/Magdir/dump for new-fs
dump file (little endian) to correctly recognize '*.mo' GNU message catalog
(little endian).
https://bugzilla.redhat.com/show_bug.cgi?id=1226215
Upstream commit: https://github.com/file/file/commit/2e5e9e16a4847b2e60cabc70e6b9bd7d633cb68a
Signed-off-by: Marek Cermak <macermak@redhat.com>
---
magic/Magdir/dump | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/magic/Magdir/dump b/magic/Magdir/dump
index 64742b7a..c5711661 100644
--- a/magic/Magdir/dump
+++ b/magic/Magdir/dump
@@ -69,6 +69,8 @@
>0 use old-dump-be
24 lelong 60012 new-fs dump file (little endian),
+# to correctly recognize '*.mo' GNU message catalog (little endian)
+!:strength - 15
>0 use \^new-dump-be
24 lelong 60011 old-fs dump file (little endian),
--
2.13.3
From f0e846528e1c839ab44895a1f13d167a4ad8def3 Mon Sep 17 00:00:00 2001
From: Marek Cermak <macermak@redhat.com>
Date: Wed, 20 Dec 2017 16:18:46 +0100
Subject: [PATCH] Resolves: #1515180 - image/gif classifed as
application/octet-stream
https://bugzilla.redhat.com/show_bug.cgi?id=1515180
Signed-off-by: Marek Cermak <macermak@redhat.com>
---
magic/Magdir/images | 2 ++
1 file changed, 2 insertions(+)
diff --git a/magic/Magdir/images b/magic/Magdir/images
index 69e8e90f..76f7e7da 100644
--- a/magic/Magdir/images
+++ b/magic/Magdir/images
@@ -468,7 +468,9 @@
!:mime image/x-unknown
# GIF
+# Strength set up to beat 0x55AA DOS/MBR signature word lookups (+65)
0 string GIF8 GIF image data
+!:strength +80
!:mime image/gif
!:apple 8BIMGIFf
>4 string 7a \b, version 8%s,
--
2.13.6
From bb421c437d406760fb9f70f49e2eb5c504528450 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 5 Jun 2017 17:40:31 +0000
Subject: [PATCH] use default to avoid dup printing (Stephan Kulow)
---
magic/Magdir/images | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/magic/Magdir/images b/magic/Magdir/images
index d14c1de19..7e6f74d5e 100644
--- a/magic/Magdir/images
+++ b/magic/Magdir/images
@@ -35,11 +35,6 @@
>>>16 ubyte <33
# skip more by looking for pixel size 0Fh 10h 18h 20h
>>>>16 ubyte&0xC0 0x00
-# skip 260-16.ico by looking for no color map
->>>>>1 ubyte 0
-# implies no first map entry
->>>>>>3 uleshort 0
->>>>>>>0 use tga-image
# Color Map
>>>>>1 belong&0xfff7ffff 0x01010000
>>>>>>0 use tga-image
@@ -47,6 +42,12 @@
>>>>>>0 use tga-image
>>>>>1 belong&0xfff7ffff 0x00030000
>>>>>>0 use tga-image
+>>>>>1 default x
+# skip 260-16.ico by looking for no color map
+>>>>>>1 ubyte 0
+# implies no first map entry
+>>>>>>>3 uleshort 0
+>>>>>>>>0 use tga-image
# display tga bitmap image information
0 name tga-image
>2 ubyte <34 Targa image data