From: Christos Zoulas Date: Sat, 24 Jul 2004 20:38:54 +0000 (+0000) Subject: more magic fixes. X-Git-Tag: FILE4_10~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e70c9faf0465677c7f413c8d7e49c3be567f9e3c;p=file more magic fixes. --- diff --git a/ChangeLog b/ChangeLog index aeeabe7f..1239626a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ + +2004-07-24 16:33 Christos Zoulas + + * magic.mime update Danny Milosavljevic + + * FreeBSD version update Oliver Eikemeier + + * utime/utimes detection Ian Lance Taylor + + * errors reading elf magic Jakub Bogusz + 2004-04-12 10:55 Christos Zoulas * make sure that magic formats match magic types during compilation diff --git a/magic/Magdir/adventure b/magic/Magdir/adventure index 864712f6..fb05cbe9 100644 --- a/magic/Magdir/adventure +++ b/magic/Magdir/adventure @@ -16,7 +16,7 @@ # Infocom # (Note: to avoid false matches Z-machine version 1 and 2 are not # recognized since only the oldest Zork I and II used them. Similarly -# there are 4 Infocom games that use verion 4 that are not recognized.) +# there are 4 Infocom games that use version 4 that are not recognized.) #0 byte 3 Infocom game data (Z-machine 3, #>2 beshort <0x7fff Release %3d, #>26 beshort >0 Size %d*2 diff --git a/magic/Magdir/amigaos b/magic/Magdir/amigaos index f7acbcf0..ba2366c7 100644 --- a/magic/Magdir/amigaos +++ b/magic/Magdir/amigaos @@ -3,9 +3,8 @@ # # From ignatios@cs.uni-bonn.de (Ignatios Souvatzis) -# Some formats are still missing: AmigaOS special IFF's, e.g.: FORM....CTLG -# (the others should be separate, anyway) # +0 belong 0x000003fa AmigaOS shared library 0 belong 0x000003f3 AmigaOS loadseg()ble executable/binary 0 belong 0x000003e7 AmigaOS object/library data # @@ -44,19 +43,6 @@ 0 belong 0x80001001 AmigaOS outline tag 0 string ##\ version catalog translation -0 string FORM IFF data ->8 string CTLG \b, CTLG message catalog ->8 string PREF \b, PREF preferences - -0 string Rar! RAR archive data, ->44 byte x v%0x, ->35 byte 0 os: MS-DOS ->35 byte 1 os: OS/2 ->35 byte 2 os: Win32 ->35 byte 3 os: Unix - -0 belong 0x000003fa AmigaOS shared library - # Amiga disk types # 0 string RDSK Rigid Disk Block diff --git a/magic/Magdir/apple b/magic/Magdir/apple index 659043c4..2b0a290c 100644 --- a/magic/Magdir/apple +++ b/magic/Magdir/apple @@ -127,3 +127,24 @@ # Beagle Bros. Apple Mechanic fonts 0 belong&0xFF00FFFF 0x6400D000 Apple Mechanic font + +# Apple Universal Disk Image Format (UDIF) - dmg files. +# From Johan Gade. +# These entries are disabled for now until we fix the following issues. +# +# Note there might be some problems with the "VAX COFF executable" +# entry. Note this entry should be placed before the mac filesystem section, +# particularly the "Apple Partition data" entry. +# +# The intended meaning of these tests is, that the file is only of the +# specified type if both of the lines are correct - i.e. if the first +# line matches and the second doesn't then it is not of that type. +# +#0 long 0x7801730d +#>4 long 0x62626060 UDIF read-only zlib-compressed image (UDZO) +# +# Note that this entry is recognized correctly by the "Apple Partition +# data" entry - however since this entry is more specific - this +# information seems to be more useful. +#0 long 0x45520200 +#>0x410 string disk\ image UDIF read/write image (UDRW) diff --git a/magic/Magdir/archive b/magic/Magdir/archive index d27e39b7..070feab6 100644 --- a/magic/Magdir/archive +++ b/magic/Magdir/archive @@ -189,7 +189,12 @@ >20 byte x - header level %d # RAR archiver (Greg Roelofs, newt@uchicago.edu) -0 string Rar! RAR archive data +0 string Rar! RAR archive data, +>44 byte x v%0x, +>35 byte 0 os: MS-DOS +>35 byte 1 os: OS/2 +>35 byte 2 os: Win32 +>35 byte 3 os: Unix # SQUISH archiver (Greg Roelofs, newt@uchicago.edu) 0 string SQSH squished archive data (Acorn RISCOS) @@ -305,3 +310,11 @@ >5 leshort &0x8000 \b, solid # Date in MS-DOS format (whatever that is) #>18 lelong x Created on + +# sfArk : compression program for Soundfonts (sf2) by Dirk Jagdmann +# +0x1A string sfArk sfArk compressed Soundfont +>0x15 string 2 +>>0x1 string >\0 Version %s +>>0x2A string >\0 : %s + diff --git a/magic/Magdir/audio b/magic/Magdir/audio index 70db774c..6a4ef95a 100644 --- a/magic/Magdir/audio +++ b/magic/Magdir/audio @@ -15,11 +15,21 @@ >12 belong 5 32-bit linear PCM, >12 belong 6 32-bit IEEE floating point, >12 belong 7 64-bit IEEE floating point, +>12 belong 8 Fragmented sample data, +>12 belong 10 DSP program, +>12 belong 11 8-bit fixed point, +>12 belong 12 16-bit fixed point, +>12 belong 13 24-bit fixed point, +>12 belong 14 32-bit fixed point, +>12 belong 18 16-bit linear with emphasis, +>12 belong 19 16-bit linear compressed, +>12 belong 20 16-bit linear with emphasis and compression, +>12 belong 21 Music kit DSP commands, >12 belong 23 8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice data encoding), ->12 belong 24 compressed (8-bit G.722 ADPCM) ->12 belong 25 compressed (3-bit G.723 ADPCM), ->12 belong 26 compressed (5-bit G.723 ADPCM), ->12 belong 27 8-bit A-law, +>12 belong 24 compressed (8-bit CCITT G.722 ADPCM) +>12 belong 25 compressed (3-bit CCITT G.723.3 ADPCM), +>12 belong 26 compressed (5-bit CCITT G.723.5 ADPCM), +>12 belong 27 8-bit A-law (CCITT G.711), >20 belong 1 mono, >20 belong 2 stereo, >20 belong 4 quad, @@ -35,7 +45,21 @@ >12 lelong 5 32-bit linear PCM, >12 lelong 6 32-bit IEEE floating point, >12 lelong 7 64-bit IEEE floating point, +>12 belong 8 Fragmented sample data, +>12 belong 10 DSP program, +>12 belong 11 8-bit fixed point, +>12 belong 12 16-bit fixed point, +>12 belong 13 24-bit fixed point, +>12 belong 14 32-bit fixed point, +>12 belong 18 16-bit linear with emphasis, +>12 belong 19 16-bit linear compressed, +>12 belong 20 16-bit linear with emphasis and compression, +>12 belong 21 Music kit DSP commands, >12 lelong 23 8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice data encoding), +>12 belong 24 compressed (8-bit CCITT G.722 ADPCM) +>12 belong 25 compressed (3-bit CCITT G.723.3 ADPCM), +>12 belong 26 compressed (5-bit CCITT G.723.5 ADPCM), +>12 belong 27 8-bit A-law (CCITT G.711), >20 lelong 1 mono, >20 lelong 2 stereo, >20 lelong 4 quad, diff --git a/magic/Magdir/claris b/magic/Magdir/claris index b18bd915..368b4732 100644 --- a/magic/Magdir/claris +++ b/magic/Magdir/claris @@ -32,7 +32,7 @@ # a t r i s t sp ^ S cr nl d i v sp # # .mth Thesaurus -# statrts with \0 but no magic header +# starts with \0 but no magic header # .chy Hyphenation file # I am not sure: 000 210 034 000 000 diff --git a/magic/Magdir/communications b/magic/Magdir/communications index bdc19d88..81417ec0 100644 --- a/magic/Magdir/communications +++ b/magic/Magdir/communications @@ -1,6 +1,6 @@ #---------------------------------------------------------------------------- -# communcation +# communication # TTCN is the Tree and Tabular Combined Notation described in ISO 9646-3. # It is used for conformance testing of communication protocols. diff --git a/magic/Magdir/diff b/magic/Magdir/diff index 81a9b82a..9e651465 100644 --- a/magic/Magdir/diff +++ b/magic/Magdir/diff @@ -6,8 +6,3 @@ 0 string ***\ 'diff' output text 0 string Only\ in\ 'diff' output text 0 string Common\ subdirectories:\ 'diff' output text - -# xdelta is like diff(1) for binary files (works for text, too). -# Available from: ftp://ftp.xcf.berkeley.edu/pub/xdelta/ -0 string %XDZ xdelta diff file ->4 string >% version %.3s diff --git a/magic/Magdir/gnu b/magic/Magdir/gnu index e84695a5..99b9830e 100644 --- a/magic/Magdir/gnu +++ b/magic/Magdir/gnu @@ -22,21 +22,3 @@ # This entry is only semi-helpful, as Gnumeric compresses its files, so # they will ordinarily reported as "compressed", but at least -z helps 39 string =5 byte x (version %c ->6 byte x \b%c ->7 byte x \b%c) - -# 67 = 'C', 111 = 'o', 43 = '+', 79 = 'O' ->4 byte 67 for C ->4 byte 111 for Objective C ->4 byte 43 for C++ ->4 byte 79 for Objective C++ - - diff --git a/magic/Magdir/iff b/magic/Magdir/iff index 319e7168..334d71e6 100644 --- a/magic/Magdir/iff +++ b/magic/Magdir/iff @@ -28,3 +28,5 @@ >8 string TDDD \b, TDDD 3-D rendering # other formats >8 string FTXT \b, FTXT formatted text +>8 string CTLG \b, CTLG message catalog +>8 string PREF \b, PREF preferences diff --git a/magic/Magdir/images b/magic/Magdir/images index 0ed435d3..b992a92b 100644 --- a/magic/Magdir/images +++ b/magic/Magdir/images @@ -514,3 +514,8 @@ # From: Jason Bacon 0 beshort 0x3020 character Computer Graphics Metafile + + +# From: Tom Hilinski +# http://www.unidata.ucar.edu/packages/netcdf/ +0 string CDF\001 netcdf file diff --git a/magic/Magdir/jpeg b/magic/Magdir/jpeg index e118846c..af646d6f 100644 --- a/magic/Magdir/jpeg +++ b/magic/Magdir/jpeg @@ -10,22 +10,113 @@ # 0 beshort 0xffd8 JPEG image data >6 string JFIF \b, JFIF standard ->6 string Exif \b, EXIF standard # The following added by Erik Rossen 1999-09-06 # in a vain attempt to add image size reporting for JFIF. Note that these # tests are not fool-proof since some perfectly valid JPEGs are currently # impossible to specify in magic(4) format. # First, a little JFIF version info: ->11 byte x \b %d. ->12 byte x \b%02d +>>11 byte x \b %d. +>>12 byte x \b%02d # Next, the resolution or aspect ratio of the image: -#>13 byte 0 \b, aspect ratio -#>13 byte 1 \b, resolution (DPI) -#>13 byte 2 \b, resolution (DPCM) -#>4 beshort x \b, segment length %d +#>>13 byte 0 \b, aspect ratio +#>>13 byte 1 \b, resolution (DPI) +#>>13 byte 2 \b, resolution (DPCM) +#>>4 beshort x \b, segment length %d # Next, show thumbnail info, if it exists: ->18 byte !0 \b, thumbnail %dx ->>19 byte x \b%d +>>18 byte !0 \b, thumbnail %dx +>>>19 byte x \b%d + +# EXIF moved down here to avoid reporting a bogus version number, +# and EXIF version number printing added. +# - Patrik R=E5dman +>6 string Exif \b, EXIF standard +# Look for EXIF IFD offset in IFD 0, and then look for EXIF version tag in EXIF IFD. +# All possible combinations of entries have to be enumerated, since no looping +# is possible. And both endians are possible... +# The combinations included below are from real-world JPEGs. +# Little-endian +>>12 string II +# IFD 0 Entry #5: +>>>70 leshort 0x8769 +# EXIF IFD Entry #1: +>>>>(78.l+14) leshort 0x9000 +>>>>>(78.l+23) byte x %c +>>>>>(78.l+24) byte x \b.%c +>>>>>(78.l+25) byte !0x30 \b%c +# IFD 0 Entry #9: +>>>118 leshort 0x8769 +# EXIF IFD Entry #3: +>>>>(126.l+38) leshort 0x9000 +>>>>>(126.l+47) byte x %c +>>>>>(126.l+48) byte x \b.%c +>>>>>(126.l+49) byte !0x30 \b%c +# IFD 0 Entry #10 +>>>130 leshort 0x8769 +# EXIF IFD Entry #3: +>>>>(138.l+38) leshort 0x9000 +>>>>>(138.l+47) byte x %c +>>>>>(138.l+48) byte x \b.%c +>>>>>(138.l+49) byte !0x30 \b%c +# EXIF IFD Entry #4: +>>>>(138.l+50) leshort 0x9000 +>>>>>(138.l+59) byte x %c +>>>>>(138.l+60) byte x \b.%c +>>>>>(138.l+61) byte !0x30 \b%c +# EXIF IFD Entry #5: +>>>>(138.l+62) leshort 0x9000 +>>>>>(138.l+71) byte x %c +>>>>>(138.l+72) byte x \b.%c +>>>>>(138.l+73) byte !0x30 \b%c +# IFD 0 Entry #11 +>>>142 leshort 0x8769 +# EXIF IFD Entry #3: +>>>>(150.l+38) leshort 0x9000 +>>>>>(150.l+47) byte x %c +>>>>>(150.l+48) byte x \b.%c +>>>>>(150.l+49) byte !0x30 \b%c +# EXIF IFD Entry #4: +>>>>(150.l+50) leshort 0x9000 +>>>>>(150.l+59) byte x %c +>>>>>(150.l+60) byte x \b.%c +>>>>>(150.l+61) byte !0x30 \b%c +# EXIF IFD Entry #5: +>>>>(150.l+62) leshort 0x9000 +>>>>>(150.l+71) byte x %c +>>>>>(150.l+72) byte x \b.%c +>>>>>(150.l+73) byte !0x30 \b%c +# Big-endian +>>12 string MM +# IFD 0 Entry #9: +>>>118 beshort 0x8769 +# EXIF IFD Entry #1: +>>>>(126.L+14) beshort 0x9000 +>>>>>(126.L+23) byte x %c +>>>>>(126.L+24) byte x \b.%c +>>>>>(126.L+25) byte !0x30 \b%c +# EXIF IFD Entry #3: +>>>>(126.L+38) beshort 0x9000 +>>>>>(126.L+47) byte x %c +>>>>>(126.L+48) byte x \b.%c +>>>>>(126.L+49) byte !0x30 \b%c +# IFD 0 Entry #10 +>>>130 beshort 0x8769 +# EXIF IFD Entry #3: +>>>>(138.L+38) beshort 0x9000 +>>>>>(138.L+47) byte x %c +>>>>>(138.L+48) byte x \b.%c +>>>>>(138.L+49) byte !0x30 \b%c +# EXIF IFD Entry #5: +>>>>(138.L+62) beshort 0x9000 +>>>>>(138.L+71) byte x %c +>>>>>(138.L+72) byte x \b.%c +>>>>>(138.L+73) byte !0x30 \b%c +# IFD 0 Entry #11 +>>>142 beshort 0x8769 +# EXIF IFD Entry #4: +>>>>(150.L+50) beshort 0x9000 +>>>>>(150.L+59) byte x %c +>>>>>(150.L+60) byte x \b.%c +>>>>>(150.L+61) byte !0x30 \b%c # Here things get sticky. We can do ONE MORE marker segment with # indirect addressing, and that's all. It would be great if we could # do pointer arithemetic like in an assembler language. Christos? @@ -33,7 +124,7 @@ # named accumulators, it would be even more effective... # At least we can show a comment if no other segments got inserted before: >(4.S+5) byte 0xFE ->>(4.S+8) string >\0 \b, "%s" +>>(4.S+8) string >\0 \b, comment: "%s" #>(4.S+5) byte 0xFE \b, comment #>>(4.S+6) beshort x \b length=%d #>>(4.S+8) string >\0 \b, "%s" diff --git a/magic/Magdir/matroska b/magic/Magdir/matroska new file mode 100644 index 00000000..ca00db4b --- /dev/null +++ b/magic/Magdir/matroska @@ -0,0 +1,14 @@ + +#------------------------------------------------------------------------------ +# matroska: file(1) magic for Matroska files +# +# See http://www.matroska.org/ +# + +# EBML id: +0 belong 0x1a45dfa3 +# DocType id: +>5 beshort 0x4282 +# DocType contents: +>>8 string matroska Matroska data + diff --git a/magic/Magdir/msdos b/magic/Magdir/msdos index 987dcf1f..1c707d46 100644 --- a/magic/Magdir/msdos +++ b/magic/Magdir/msdos @@ -164,9 +164,13 @@ 0 string \333\245-\0\0\0 Microsoft Office Document # 2080 string Microsoft\ Excel\ 5.0\ Worksheet %s +2080 string Foglio\ di\ lavoro\ Microsoft\ Exce %s # # Pawel Wiecek (for polish Excel) 2114 string Biff5 Microsoft Excel 5.0 Worksheet +# Italian MS-Excel +2121 string Biff5 Microsoft Excel 5.0 Worksheet +0 string \x09\x04\x06\x00\x00\x00\x10\x00 Microsoft Excel Worksheet # 0 belong 0x00001a00 Lotus 1-2-3 >4 belong 0x00100400 wk3 document data @@ -362,3 +366,11 @@ # From: Dirk Jagdmann 0 lelong 0x00035f3f Windows 3.x help file +# Christophe Monniez +0 string Client\ UrlCache\ MMF Microsoft Internet Explorer Cache File +>20 string >\0 Version %s +0 string \xCF\xAD\x12\xFE Microsoft Outlook Express DBX File +>4 byte =0xC5 Message database +>4 byte =0xC6 Folder database +>4 byte =0xC7 Accounts informations +>4 byte =0x30 Offline database diff --git a/magic/Magdir/spec b/magic/Magdir/spec new file mode 100644 index 00000000..bfda3064 --- /dev/null +++ b/magic/Magdir/spec @@ -0,0 +1,20 @@ + +#------------------------------------------------------------------------------ +# spec: file(1) magic for SPEC raw results (*.raw, *.rsf) +# +# Cloyce D. Spradling + +0 string spec SPEC +>4 string .cpu CPU +>>8 string <: \b%.4s +>>12 string . raw result text + +17 string version=SPECjbb SPECjbb +>32 string <: \b%.4s +>>37 string <: v%.4s raw result text + +0 string BEGIN\040SPECWEB SPECweb +>13 string <: \b%.2s +>>15 string _SSL \b_SSL +>>>20 string <: v%.4s raw result text +>>16 string <: v%.4s raw result text diff --git a/magic/Magdir/vorbis b/magic/Magdir/vorbis index e2596cbc..5957ea0d 100644 --- a/magic/Magdir/vorbis +++ b/magic/Magdir/vorbis @@ -17,9 +17,18 @@ ##>4 byte 0 revision 0 >4 byte 0 ##>>14 lelong x (Serial %lX) -# non-Vorbis content: FLAC (Free Loss-lessy Audio Codec, -# http://flac.sourceforge.net) +# non-Vorbis content: FLAC (Free Lossless Audio Codec, http://flac.sourceforge.net) >>28 string fLaC \b, FLAC audio +# non-Vorbis content: Theora +>>28 string \x80theora \b, Theora video +# non-Vorbis content: Speex +>>28 string Speex\ \ \ \b, Speex audio +# non-Vorbis content: OGM +>>28 string \x01video\0\0\0 \b, OGM video +>>>37 string/c div3 (DivX 3) +>>>37 string/c divx (DivX 4) +>>>37 string/c dx50 (DivX 5) +>>>37 string/c xvid (XviD) # --- First vorbis packet - general header --- >>28 string \x01vorbis \b, Vorbis audio, >>>35 lelong !0 UNKNOWN VERSION %lu, @@ -57,22 +66,22 @@ >>>>(84.b+96) string/c Xiphophorus\ libVorbis\ I \b, created by: Xiphophorus libVorbis I >>>>>(84.b+120) string >00000000 # Map to beta version numbers: ->>>>>>(84.b+120) string <20000508 (>>>>>(84.b+120) string 20000508 (beta1/2) +>>>>>>(84.b+120) string <20000508 (>>>>>(84.b+120) string 20000508 (1.0 beta 1 or beta 2) >>>>>>(84.b+120) string >20000508 >>>>>>>(84.b+120) string <20001031 (beta2-3) ->>>>>>(84.b+120) string 20001031 (beta3) +>>>>>>(84.b+120) string 20001031 (1.0 beta 3) >>>>>>(84.b+120) string >20001031 >>>>>>>(84.b+120) string <20010225 (beta3-4) ->>>>>>(84.b+120) string 20010225 (beta4) +>>>>>>(84.b+120) string 20010225 (1.0 beta 4) >>>>>>(84.b+120) string >20010225 >>>>>>>(84.b+120) string <20010615 (beta4-RC1) ->>>>>>(84.b+120) string 20010615 (RC1) ->>>>>>(84.b+120) string 20010813 (RC2) +>>>>>>(84.b+120) string 20010615 (1.0 RC1) +>>>>>>(84.b+120) string 20010813 (1.0 RC2) >>>>>>(84.b+120) string 20010816 (RC2 - Garf tuned v1) >>>>>>(84.b+120) string 20011014 (RC2 - Garf tuned v2) ->>>>>>(84.b+120) string 20011217 (pre-RC3 CVS) ->>>>>>(84.b+120) string 20011231 (RC3) +>>>>>>(84.b+120) string 20011217 (1.0 RC3) +>>>>>>(84.b+120) string 20011231 (1.0 RC3) # Some pre-1.0 CVS snapshots still had "Xiphphorus"... >>>>>>(84.b+120) string >20011231 (pre-1.0 CVS) # For the 1.0 release, Xiphophorus is replaced by Xiph.Org @@ -80,4 +89,5 @@ >>>>>(84.b+117) string >00000000 >>>>>>(84.b+117) string <20020717 (pre-1.0 CVS) >>>>>>(84.b+117) string 20020717 (1.0) ->>>>>>(84.b+117) string >20020717 (post-1.0 CVS) +>>>>>>(84.b+117) string 20030909 (1.0.1) +>>>>>>(84.b+117) string 20040629 (1.1.0 RC1) diff --git a/magic/Makefile.am b/magic/Makefile.am index c24fd7e0..0c716df5 100644 --- a/magic/Makefile.am +++ b/magic/Makefile.am @@ -53,6 +53,7 @@ Magdir/cisco \ Magdir/citrus \ Magdir/claris \ Magdir/clipper \ +Magdir/spec \ Magdir/commands \ Magdir/communications \ Magdir/compress \ @@ -111,6 +112,7 @@ Magdir/magic \ Magdir/mail.news \ Magdir/maple \ Magdir/mathematica \ +Magdir/matroska \ Magdir/mcrypt \ Magdir/mime \ Magdir/mips \ diff --git a/magic/Makefile.in b/magic/Makefile.in index 514089e3..3931a6ae 100644 --- a/magic/Makefile.in +++ b/magic/Makefile.in @@ -160,6 +160,7 @@ Magdir/cisco \ Magdir/citrus \ Magdir/claris \ Magdir/clipper \ +Magdir/spec \ Magdir/commands \ Magdir/communications \ Magdir/compress \ @@ -218,6 +219,7 @@ Magdir/magic \ Magdir/mail.news \ Magdir/maple \ Magdir/mathematica \ +Magdir/matroska \ Magdir/mcrypt \ Magdir/mime \ Magdir/mips \ diff --git a/magic/magic.mime b/magic/magic.mime index 3aa33cf7..d314c4f4 100644 --- a/magic/magic.mime +++ b/magic/magic.mime @@ -11,10 +11,103 @@ # Localstuff: file(1) magic for locally observed files # Add any locally observed files here. +# Real Audio (Magic .ra\0375) +0 belong 0x2e7261fd audio/x-pn-realaudio +0 string .RMF application/vnd.rn-realmedia + +#video/x-pn-realvideo +#video/vnd.rn-realvideo +#application/vnd.rn-realmedia +# sigh, there are many mimes for that but the above are the most common. + +# Taken from magic, converted to magic.mime +# mime types according to http://www.geocities.com/nevilo/mod.htm: +# audio/it .it +# audio/x-zipped-it .itz +# audio/xm fasttracker modules +# audio/x-s3m screamtracker modules +# audio/s3m screamtracker modules +# audio/x-zipped-mod mdz +# audio/mod mod +# audio/x-mod All modules (mod, s3m, 669, mtm, med, xm, it, mdz, stm, itz, xmz, s3z) + +# Taken from loader code from mikmod version 2.14 +# by Steve McIntyre (stevem@chiark.greenend.org.uk) +# added title printing on 2003-06-24 +0 string MAS_UTrack_V00 +>14 string >/0 audio/x-mod +#audio/x-tracker-module + +#0 string UN05 MikMod UNI format module sound data + +0 string Extended\ Module: audio/x-mod +#audio/x-tracker-module +##>17 string >\0 Title: "%s" + +21 string/c !SCREAM! audio/x-mod +#audio/x-screamtracker-module +21 string BMOD2STM audio/x-mod +#audio/x-screamtracker-module +1080 string M.K. audio/x-mod +#audio/x-protracker-module +#>0 string >\0 Title: "%s" +1080 string M!K! audio/x-mod +#audio/x-protracker-module +#>0 string >\0 Title: "%s" +1080 string FLT4 audio/x-mod +#audio/x-startracker-module +#>0 string >\0 Title: "%s" +1080 string FLT8 audio/x-mod +#audio/x-startracker-module +#>0 string >\0 Title: "%s" +1080 string 4CHN audio/x-mod +#audio/x-fasttracker-module +#>0 string >\0 Title: "%s" +1080 string 6CHN audio/x-mod +#audio/x-fasttracker-module +#>0 string >\0 Title: "%s" +1080 string 8CHN audio/x-mod +#audio/x-fasttracker-module +#>0 string >\0 Title: "%s" +1080 string CD81 audio/x-mod +#audio/x-oktalyzer-tracker-module +#>0 string >\0 Title: "%s" +1080 string OKTA audio/x-mod +#audio/x-oktalyzer-tracker-module +#>0 string >\0 Title: "%s" +# Not good enough. +#1082 string CH +#>1080 string >/0 %.2s-channel Fasttracker "oktalyzer" module sound data +1080 string 16CN audio/x-mod +#audio/x-taketracker-module +#>0 string >\0 Title: "%s" +1080 string 32CN audio/x-mod +#audio/x-taketracker-module +#>0 string >\0 Title: "%s" + +# Impuse tracker module (it) +0 string IMPM audio/x-mod +#>4 string >\0 "%s" +#>40 leshort !0 compatible w/ITv%x +#>42 leshort !0 created w/ITv%x + #------------------------------------------------------------------------------ # end local stuff #------------------------------------------------------------------------------ +# xml based formats! + +# svg + +0 string \38 string \<\!DOCTYPE\040svg image/svg+xml + + +# xml +0 string \162 string >0 : %s + +# BinHex is the Macintosh ASCII-encoded file format (see also "apple") +# Daniel Quinlan, quinlan@yggdrasil.com +11 string must\ be\ converted\ with\ BinHex\ 4 application/mac-binhex40 +##>41 string x \b, version %.3s + #------------------------------------------------------------------------------ # lisp: file(1) magic for lisp programs @@ -788,3 +895,13 @@ # From: stephane.loeuillet@tiscali.f # http://www.djvuzone.org/ 0 string AT&TFORM image/x.djvu + +# Danny Milosavljevic +# this are adrift (adventure game standard) game files, extension .taf +# depending on version magic continues with 0x93453E6139FA (V 4.0) +# 0x9445376139FA (V 3.90) +# 0x9445366139FA (V 3.80) +# this is from source (http://www.adrift.org.uk/) and I have some taf +# files, and checked them. +#0 belong 0x3C423FC9 +#>4 belong 0x6A87C2CF application/x-adrift diff --git a/src/apprentice.c b/src/apprentice.c index 07c6c102..531c7915 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -50,7 +50,7 @@ #endif #ifndef lint -FILE_RCSID("@(#)$Id: apprentice.c,v 1.77 2004/06/04 14:40:19 christos Exp $") +FILE_RCSID("@(#)$Id: apprentice.c,v 1.78 2004/07/24 20:38:56 christos Exp $") #endif /* lint */ #define EATAB {while (isascii((unsigned char) *l) && \ @@ -213,6 +213,7 @@ file_delmagic(struct magic *p, int type, size_t entries) break; case 1: p--; + /*FALLTHROUGH*/ case 0: free(p); break; diff --git a/src/readelf.c b/src/readelf.c index fac6f344..ec63a5ea 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -39,7 +39,7 @@ #include "readelf.h" #ifndef lint -FILE_RCSID("@(#)$Id: readelf.c,v 1.40 2004/07/24 19:23:22 christos Exp $") +FILE_RCSID("@(#)$Id: readelf.c,v 1.41 2004/07/24 20:38:56 christos Exp $") #endif #ifdef ELFCORE @@ -418,19 +418,36 @@ donote(struct magic_set *ms, unsigned char *nbuf, size_t offset, size_t size, * otherwise 1>xx */ if (desc / 100000 < 5) { - if (file_printf(ms, " %d.%d", desc / 100000, - desc / 10000 % 10) == -1) - return size; - if (desc / 1000 % 10 > 0) - if (file_printf(ms, ".%d", desc / 1000 % 10) - == -1) + if (desc / 10000 % 10 == 9) { + if (file_printf(ms, " %d.%d", desc / 100000, + 9 + desc / 1000 % 10) == -1) + return size; + } else { + if (file_printf(ms, " %d.%d", desc / 100000, + desc / 10000 % 10) == -1) return size; + if (desc / 1000 % 10 > 0) + if (file_printf(ms, ".%d", desc / 1000 % 10) + == -1) + return size; + } + if (desc / 10000 % 10 > 5) { + desc %= 1000; + if (desc >= 100) { + if (file_printf(ms, "-STABLE (rev %d)", + desc % 100) == -1) + return size; + } else if (desc != 0) { + if (file_printf(ms, ".%d", desc) == -1) + return size; + } + } } else { if (file_printf(ms, " %d.%d", desc / 100000, desc / 1000 % 100) == -1) return size; desc %= 1000; - if (desc > 100) { + if (desc >= 100) { if (file_printf(ms, "-CURRENT (rev %d)", desc % 100) == -1) return size; diff --git a/src/softmagic.c b/src/softmagic.c index ef37dfdc..4e063b9d 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -44,7 +44,7 @@ #ifndef lint -FILE_RCSID("@(#)$Id: softmagic.c,v 1.65 2004/03/09 18:49:58 christos Exp $") +FILE_RCSID("@(#)$Id: softmagic.c,v 1.66 2004/07/24 20:38:56 christos Exp $") #endif /* lint */ private int match(struct magic_set *, struct magic *, uint32_t, @@ -678,7 +678,7 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, if (m->flag & INDIR) { switch (m->in_type) { case FILE_BYTE: - if (m->in_offset) + if (m->in_offset) { switch (m->in_op&0x7F) { case FILE_OPAND: offset = p->b & m->in_offset; @@ -705,12 +705,14 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, offset = p->b % m->in_offset; break; } + } else + offset = p->b; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_BESHORT: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = (short)((p->hs[0]<<8)| (p->hs[1])) & @@ -752,12 +754,15 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, m->in_offset; break; } + } else + offset = (short)((p->hs[0]<<8)| + (p->hs[1])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LESHORT: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = (short)((p->hs[1]<<8)| (p->hs[0])) & @@ -799,12 +804,15 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, m->in_offset; break; } + } else + offset = (short)((p->hs[1]<<8)| + (p->hs[0])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_SHORT: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = p->h & m->in_offset; break; @@ -830,12 +838,15 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, offset = p->h % m->in_offset; break; } + } + else + offset = p->h; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_BELONG: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = (int32_t)((p->hl[0]<<24)| (p->hl[1]<<16)| @@ -893,12 +904,17 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, m->in_offset; break; } + } else + offset = (int32_t)((p->hl[0]<<24)| + (p->hl[1]<<16)| + (p->hl[2]<<8)| + (p->hl[3])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LELONG: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = (int32_t)((p->hl[3]<<24)| (p->hl[2]<<16)| @@ -956,12 +972,17 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, m->in_offset; break; } + } else + offset = (int32_t)((p->hl[3]<<24)| + (p->hl[2]<<16)| + (p->hl[1]<<8)| + (p->hl[0])); if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LONG: - if (m->in_offset) - switch (m->in_op&0x7F) { + if (m->in_offset) { + switch (m->in_op & 0x7F) { case FILE_OPAND: offset = p->l & m->in_offset; break; @@ -994,6 +1015,8 @@ mget(struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, * sleep; */ } + } else + offset = p->l; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break;