diff options
author | Alex Henrie <alexhenrie24@gmail.com> | 2023-11-22 08:04:15 -0700 |
---|---|---|
committer | David Faure <faure@kde.org> | 2024-01-28 18:48:17 +0000 |
commit | 0a73e2455bff6d4fbc7d1c90d2d681c15beb92ba (patch) | |
tree | d06db3196c11d4d991a427fcfba7a3165c5adbfb | |
parent | 10e44e6fa5fa6122b7fb9f2b9c4053baa538f4ba (diff) |
Improve detection of application/x-ole-storage subtypes
Most OLE file formats include a 128-bit root class identifier somewhere
after the 592nd byte.
StarImpress files are essentially bundles of StarDraw files, hence the
need to give the StarImpress magic higher priority.
http://fileformats.archiveteam.org/wiki/OLE
24 files changed, 130 insertions, 8 deletions
diff --git a/data/freedesktop.org.xml.in b/data/freedesktop.org.xml.in index 1fa11f9..bd09d6c 100644 --- a/data/freedesktop.org.xml.in +++ b/data/freedesktop.org.xml.in @@ -704,7 +704,11 @@ command to generate the output files. <comment>Excel spreadsheet</comment> <sub-class-of type="application/x-ole-storage"/> <generic-icon name="x-office-spreadsheet"/> - <magic> + <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x10\x08\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x46" offset="592:8192"/> + <match type="string" value="\x20\x08\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x46" offset="592:8192"/> + </match> <match type="string" value="Microsoft Excel 5.0 Worksheet" offset="2080"/> </magic> <glob pattern="*.xls"/> @@ -747,6 +751,12 @@ command to generate the output files. <comment>PowerPoint presentation</comment> <sub-class-of type="application/x-ole-storage"/> <generic-icon name="x-office-presentation"/> + <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x10\x8d\x81\x64\x9b\x4f\xcf\x11\x86\xea\x00\xaa\x00\xb9\x29\xe8" offset="592:8192"/> + <match type="string" value="\x70\xae\x7b\xea\x3b\xfb\xcd\x11\xa9\x03\x00\xaa\x00\x51\x0e\xa3" offset="592:8192"/> + </match> + </magic> <glob pattern="*.ppz"/> <glob pattern="*.ppt"/> <glob pattern="*.pps"/> @@ -853,6 +863,16 @@ command to generate the output files. <comment>Microsoft Works document</comment> <sub-class-of type="application/x-ole-storage"/> <generic-icon name="x-office-document"/> + <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x02\x13\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x46" offset="592:8192"/> + <match type="string" value="\x03\x13\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x46" offset="592:8192"/> + <match type="string" value="\xb2\x5a\xa4\x0e\x0a\x9e\xd1\x11\xa4\x07\x00\xc0\x4f\xb9\x32\xba" offset="592:8192"/> + <match type="string" value="\xc0\xc7\x26\x6e\xb9\x8c\xd3\x11\xa1\xc8\x00\xc0\x4f\x61\x24\x52" offset="592:8192"/> + <match type="string" value="\xc2\xdb\xcd\x28\xe2\x0a\xce\x11\xa2\x9a\x00\xaa\x00\x4a\x1a\x72" offset="592:8192"/> + <match type="string" value="\xc3\xdb\xcd\x28\xe2\x0a\xce\x11\xa2\x9a\x00\xaa\x00\x4a\x1a\x72" offset="592:8192"/> + </match> + </magic> <glob pattern="*.wcm"/> <glob pattern="*.wdb"/> <glob pattern="*.wks"/> @@ -863,6 +883,12 @@ command to generate the output files. <comment>Microsoft Visio document</comment> <sub-class-of type="application/x-ole-storage"/> <generic-icon name="x-office-document"/> + <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x13\x1a\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x46" offset="592:8192"/> + <match type="string" value="\x14\x1a\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x46" offset="592:8192"/> + </match> + </magic> <glob pattern="*.vsd"/> <glob pattern="*.vst"/> <glob pattern="*.vsw"/> @@ -873,6 +899,10 @@ command to generate the output files. <sub-class-of type="application/x-ole-storage"/> <generic-icon name="x-office-document"/> <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x00\x09\x02\x00\x00\x00\x00\x00\x00\xc0\x46\x00\x00\x00\x00\x00" offset="592:8192"/> + <match type="string" value="\x06\x09\x02\x00\x00\x00\x00\x00\x00\xc0\x46\x00\x00\x00\x00\x00" offset="592:8192"/> + </match> <match type="string" value="\x31\xbe\x00\x00" offset="0"/> <match type="string" value="PO^Q`" offset="0"/> <match type="string" value="\376\067\0\043" offset="0"/> @@ -923,22 +953,53 @@ command to generate the output files. </mime-type> <mime-type type="application/vnd.stardivision.calc"> <comment>StarCalc spreadsheet</comment> + <sub-class-of type="application/x-ole-storage"/> <generic-icon name="x-office-spreadsheet"/> + <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x41\xd4\x61\x63\x35\x42\xd0\x11\x89\xcb\x00\x80\x29\xe4\xb0\xb1" offset="592:8192"/> + <match type="string" value="\x61\xb8\xa5\xc6\xd6\x85\xd1\x11\x89\xcb\x00\x80\x29\xe4\xb0\xb1" offset="592:8192"/> + <match type="string" value="\xa0\x3f\x54\x3f\xa6\xb6\x1b\x10\x99\x61\x04\x02\x1c\x00\x70\x02" offset="592:8192"/> + </match> + </magic> <glob pattern="*.sdc"/> </mime-type> <mime-type type="application/vnd.stardivision.chart"> <comment>StarChart chart</comment> + <sub-class-of type="application/x-ole-storage"/> <generic-icon name="x-office-spreadsheet"/> + <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x21\x43\x88\xbf\xdd\x85\xd1\x11\x89\xd0\x00\x80\x29\xe4\xb0\xb1" offset="592:8192"/> + <match type="string" value="\xe0\x99\x9c\xfb\x6d\x2c\x1c\x10\x8e\x2c\x00\x00\x1b\x4c\xc7\x11" offset="592:8192"/> + <match type="string" value="\xe0\xb7\xb3\x02\x25\x42\xd0\x11\x89\xca\x00\x80\x29\xe4\xb0\xb1" offset="592:8192"/> + </match> + </magic> <glob pattern="*.sds"/> </mime-type> <mime-type type="application/vnd.stardivision.draw"> <comment>StarDraw drawing</comment> + <sub-class-of type="application/x-ole-storage"/> <generic-icon name="image-x-generic"/> + <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\xa0\x05\x89\x2e\xbd\x85\xd1\x11\x89\xd0\x00\x80\x29\xe4\xb0\xb1" offset="592:8192"/> + <match type="string" value="\xe0\xaa\x10\xaf\x6d\xb3\x1b\x10\x99\x61\x04\x02\x1c\x00\x70\x02" offset="592:8192"/> + </match> + </magic> <glob pattern="*.sda"/> </mime-type> <mime-type type="application/vnd.stardivision.impress"> <comment>StarImpress presentation</comment> + <sub-class-of type="application/x-ole-storage"/> <generic-icon name="x-office-presentation"/> + <magic priority="70"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x21\x72\x5c\x56\xbc\x85\xd1\x11\x89\xd0\x00\x80\x29\xe4\xb0\xb1" offset="592:8192"/> + <match type="string" value="\xc0\x3c\x2d\x01\x16\x42\xd0\x11\x89\xcb\x00\x80\x29\xe4\xb0\xb1" offset="592:8192"/> + <match type="string" value="\xe0\xaa\x10\xaf\x6d\xb3\x1b\x10\x99\x61\x04\x02\x1c\x00\x70\x02" offset="592:8192"/> + </match> + </magic> <glob pattern="*.sdd"/> <glob pattern="*.sdp"/> </mime-type> @@ -948,16 +1009,30 @@ command to generate the output files. </mime-type> <mime-type type="application/vnd.stardivision.math"> <comment>StarMath formula</comment> + <sub-class-of type="application/x-ole-storage"/> <generic-icon name="x-office-document"/> + <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x40\xe6\xb5\xff\xde\x85\xd1\x11\x89\xd0\x00\x80\x29\xe4\xb0\xb1" offset="592:8192"/> + <match type="string" value="\x60\x04\x59\xd4\xfd\x35\x1c\x10\xb1\x2a\x04\x02\x1c\x00\x70\x02" offset="592:8192"/> + <match type="string" value="\xe1\xb7\xb3\x02\x25\x42\xd0\x11\x89\xca\x00\x80\x29\xe4\xb0\xb1" offset="592:8192"/> + </match> + </magic> <glob pattern="*.smf"/> </mime-type> <mime-type type="application/vnd.stardivision.writer"> <comment>StarWriter document</comment> + <sub-class-of type="application/x-ole-storage"/> <generic-icon name="x-office-document"/> <glob pattern="*.sdw"/> <glob pattern="*.vor"/> <glob pattern="*.sgl"/> <magic priority="90"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x40\x7e\x5c\xdc\x5c\xb3\x1b\x10\x99\x61\x04\x02\x1c\x00\x70\x02" offset="592:8192"/> + <match type="string" value="\xb0\xe9\x04\x8b\x0e\x42\xd0\x11\xa4\x5e\x00\xa0\x24\x9d\x57\xb1" offset="592:8192"/> + <match type="string" value="\xd1\xf9\x0c\xc2\xae\x85\xd1\x11\xaa\xb4\x00\x06\x09\x7d\x56\x1a" offset="592:8192"/> + </match> <match type="string" value="StarWriter" offset="2089" /> </magic> <alias type="application/vnd.stardivision.writer-global"/> @@ -1413,9 +1488,12 @@ command to generate the output files. <alias type="application/x-wordperfect"/> <alias type="application/wordperfect"/> <generic-icon name="x-office-document"/> - <magic> + <magic priority="60"> <match type="string" value="WPC" offset="1"/> <!-- <match type="big32" value="0xff575053c405" offset="0"/> --> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\xff\x73\x98\x51\xad\x2d\x20\x02\x19\x37\x00\x00\x92\x96\x79\xcd" offset="592:8192"/> + </match> </magic> <glob pattern="*.wp"/> <glob pattern="*.wp4"/> @@ -3657,8 +3735,7 @@ command to generate the output files. <comment>OLE2 compound document storage</comment> <generic-icon name="x-office-document"/> <magic> - <match type="string" value="\320\317\021\340\241\261\032\341" offset="0"/> - <match type="little32" value="0xe011cfd0" offset="0"/> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"/> </magic> </mime-type> <mime-type type="application/vnd.microsoft.windows.thumbnail-cache"> @@ -3676,12 +3753,22 @@ command to generate the output files. <mime-type type="application/vnd.ms-publisher"> <comment>Microsoft Publisher document</comment> <sub-class-of type="application/x-ole-storage"/> + <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x01\x12\x02\x00\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x46" offset="592:8192"/> + </match> + </magic> <glob pattern="*.pub"/> </mime-type> <mime-type type="application/x-msi"> <comment>Windows Installer package</comment> <sub-class-of type="application/x-ole-storage"/> <generic-icon name="package-x-generic"/> + <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x84\x10\x0c\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x46" offset="592:8192"/> + </match> + </magic> <glob pattern="*.msi"/> </mime-type> <mime-type type="application/appx"> @@ -3860,9 +3947,15 @@ command to generate the output files. <mime-type type="application/x-quattropro"> <comment>Quattro Pro spreadsheet</comment> <generic-icon name="x-office-spreadsheet"/> + <magic priority="60"> + <match type="string" value="\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" offset="0"> + <match type="string" value="\x00\xb4\x02\x00\x00\x00\x00\x00\xc0\x00\x00\x00\x00\x00\x00\x46" offset="592:8192"/> + </match> + </magic> <glob pattern="*.wb1"/> <glob pattern="*.wb2"/> <glob pattern="*.wb3"/> + <glob pattern="*.qpw"/> </mime-type> <mime-type type="application/x-quicktime-media-link"> <comment>QuickTime playlist</comment> diff --git a/tests/mime-detection/compound.wpd b/tests/mime-detection/compound.wpd Binary files differnew file mode 100644 index 0000000..72b6fa2 --- /dev/null +++ b/tests/mime-detection/compound.wpd diff --git a/tests/mime-detection/list b/tests/mime-detection/list index 5338ded..3149c0e 100644 --- a/tests/mime-detection/list +++ b/tests/mime-detection/list @@ -162,6 +162,35 @@ ooo-test.fodg application/vnd.oasis.opendocument.graphics-flat-xml ox ooo-test.fodp application/vnd.oasis.opendocument.presentation-flat-xml ox ooo-test.fods application/vnd.oasis.opendocument.spreadsheet-flat-xml ox ooo-test.fodt application/vnd.oasis.opendocument.text-flat-xml ox +# Created with StarOffice 3.1 +so3.sdw application/vnd.stardivision.writer +so3.sdc application/vnd.stardivision.calc +so3.sdd application/vnd.stardivision.impress +so3.sds application/vnd.stardivision.chart +# Created with StarOffice 4.0 +so4.sdw application/vnd.stardivision.writer +so4.sdc application/vnd.stardivision.calc +so4.sdd application/vnd.stardivision.impress +so4.sds application/vnd.stardivision.chart +so4.smf application/vnd.stardivision.math +# Created with StarOffice 5.2 +so5.sdw application/vnd.stardivision.writer +so5.sdc application/vnd.stardivision.calc +so5.sdd application/vnd.stardivision.impress +so5.sda application/vnd.stardivision.draw +so5.sds application/vnd.stardivision.chart +so5.smf application/vnd.stardivision.math +# Created with LibreOffice 7.6 +lo7.doc application/msword +lo7.xls application/vnd.ms-excel +lo7.ppt application/vnd.ms-powerpoint +# Created with WordPerfect 9 +regular.wpd application/vnd.wordperfect +compound.wpd application/vnd.wordperfect +# Created with Quattro Pro 6 +quattro6.wb2 application/x-quattropro ox +# Created with Quattro Pro 9 +quattro9.qpw application/x-quattropro # Copied from https://bugs.freedesktop.org/show_bug.cgi?id=20604 foo.doc application/msword # Copied from http://bugzilla.abisource.com/show_bug.cgi?id=6435 @@ -172,7 +201,7 @@ ocf10-20060911.epub application/epub+zip # Copied from https://standardebooks.org/ebooks/elizabeth-barrett-browning/sonnets-from-the-portuguese elizabeth-barrett-browning_sonnets-from-the-portuguese.azw3 application/vnd.amazon.mobi8-ebook ox # Copied from http://libwps.svn.sourceforge.net/viewvc/libwps/trunk/reference/ -test.wps application/vnd.ms-works ox +test.wps application/vnd.ms-works # Copied from https://bugs.freedesktop.org/show_bug.cgi?id=45922 test.xlr application/vnd.ms-works ox # Copied from http://openxmldeveloper.org/articles/OpenXMLsamples.aspx @@ -203,7 +232,7 @@ white_640x480.kra application/x-krita test.mobi application/x-mobipocket-ebook test.lwp application/vnd.lotus-wordpro # Copied from https://bugs.freedesktop.org/show_bug.cgi?id=64946 -TS010082249.pub application/vnd.ms-publisher ox +TS010082249.pub application/vnd.ms-publisher test.key application/vnd.apple.keynote # Created with Numbers 3.5 test.numbers application/vnd.apple.numbers ox @@ -260,7 +289,7 @@ live-streaming.m3u application/vnd.apple.mpegurl x # Copied from http://qthttp.apple.com.edgesuite.net/1006ad9g4hjk/all_w.m3u8 all_w.m3u8 application/vnd.apple.mpegurl x # Copied from http://bugs.freedesktop.org/show_bug.cgi?id=42922 -test.vsd application/vnd.visio ox +test.vsd application/vnd.visio # Copied from https://bugs.freedesktop.org/show_bug.cgi?id=40800 test.dts audio/vnd.dts test.dtshd audio/vnd.dts.hd @@ -505,7 +534,7 @@ test.jar application/java-archive ox # Copied from http://bugs.freedesktop.org/show_bug.cgi?id=12620 hello.pack application/x-java-pack200 # Copied from http://www.apache.org/dist/httpd/binaries/win32/apache_2.2.9-win32-x86-no_ssl-r2.msi -test.msi application/x-msi ox +test.msi application/x-msi # Created by building the default blank Universal Windows C++ app in Visual Studio 2022 App1_1.0.0.0_x64.appx application/appx ox App1_1.0.0.0_x64.appxbundle application/appxbundle ox diff --git a/tests/mime-detection/lo7.doc b/tests/mime-detection/lo7.doc Binary files differnew file mode 100644 index 0000000..db71a1c --- /dev/null +++ b/tests/mime-detection/lo7.doc diff --git a/tests/mime-detection/lo7.ppt b/tests/mime-detection/lo7.ppt Binary files differnew file mode 100644 index 0000000..bedaacb --- /dev/null +++ b/tests/mime-detection/lo7.ppt diff --git a/tests/mime-detection/lo7.xls b/tests/mime-detection/lo7.xls Binary files differnew file mode 100644 index 0000000..ae90db5 --- /dev/null +++ b/tests/mime-detection/lo7.xls diff --git a/tests/mime-detection/quattro6.wb2 b/tests/mime-detection/quattro6.wb2 Binary files differnew file mode 100644 index 0000000..fb032ea --- /dev/null +++ b/tests/mime-detection/quattro6.wb2 diff --git a/tests/mime-detection/quattro9.qpw b/tests/mime-detection/quattro9.qpw Binary files differnew file mode 100644 index 0000000..a1e2f19 --- /dev/null +++ b/tests/mime-detection/quattro9.qpw diff --git a/tests/mime-detection/regular.wpd b/tests/mime-detection/regular.wpd Binary files differnew file mode 100644 index 0000000..4c4c6e5 --- /dev/null +++ b/tests/mime-detection/regular.wpd diff --git a/tests/mime-detection/so3.sdc b/tests/mime-detection/so3.sdc Binary files differnew file mode 100644 index 0000000..c8f5991 --- /dev/null +++ b/tests/mime-detection/so3.sdc diff --git a/tests/mime-detection/so3.sdd b/tests/mime-detection/so3.sdd Binary files differnew file mode 100644 index 0000000..89346fb --- /dev/null +++ b/tests/mime-detection/so3.sdd diff --git a/tests/mime-detection/so3.sds b/tests/mime-detection/so3.sds Binary files differnew file mode 100644 index 0000000..aba5cee --- /dev/null +++ b/tests/mime-detection/so3.sds diff --git a/tests/mime-detection/so3.sdw b/tests/mime-detection/so3.sdw Binary files differnew file mode 100644 index 0000000..4957951 --- /dev/null +++ b/tests/mime-detection/so3.sdw diff --git a/tests/mime-detection/so4.sdc b/tests/mime-detection/so4.sdc Binary files differnew file mode 100644 index 0000000..fa84662 --- /dev/null +++ b/tests/mime-detection/so4.sdc diff --git a/tests/mime-detection/so4.sdd b/tests/mime-detection/so4.sdd Binary files differnew file mode 100644 index 0000000..2280762 --- /dev/null +++ b/tests/mime-detection/so4.sdd diff --git a/tests/mime-detection/so4.sds b/tests/mime-detection/so4.sds Binary files differnew file mode 100644 index 0000000..dc9d0eb --- /dev/null +++ b/tests/mime-detection/so4.sds diff --git a/tests/mime-detection/so4.sdw b/tests/mime-detection/so4.sdw Binary files differnew file mode 100644 index 0000000..f5d56d9 --- /dev/null +++ b/tests/mime-detection/so4.sdw diff --git a/tests/mime-detection/so4.smf b/tests/mime-detection/so4.smf Binary files differnew file mode 100644 index 0000000..6ddb036 --- /dev/null +++ b/tests/mime-detection/so4.smf diff --git a/tests/mime-detection/so5.sda b/tests/mime-detection/so5.sda Binary files differnew file mode 100644 index 0000000..e517d24 --- /dev/null +++ b/tests/mime-detection/so5.sda diff --git a/tests/mime-detection/so5.sdc b/tests/mime-detection/so5.sdc Binary files differnew file mode 100644 index 0000000..cf5ffb8 --- /dev/null +++ b/tests/mime-detection/so5.sdc diff --git a/tests/mime-detection/so5.sdd b/tests/mime-detection/so5.sdd Binary files differnew file mode 100644 index 0000000..b344024 --- /dev/null +++ b/tests/mime-detection/so5.sdd diff --git a/tests/mime-detection/so5.sds b/tests/mime-detection/so5.sds Binary files differnew file mode 100644 index 0000000..ba3ee98 --- /dev/null +++ b/tests/mime-detection/so5.sds diff --git a/tests/mime-detection/so5.sdw b/tests/mime-detection/so5.sdw Binary files differnew file mode 100644 index 0000000..5a45742 --- /dev/null +++ b/tests/mime-detection/so5.sdw diff --git a/tests/mime-detection/so5.smf b/tests/mime-detection/so5.smf Binary files differnew file mode 100644 index 0000000..77b2c2c --- /dev/null +++ b/tests/mime-detection/so5.smf |