Imported Upstream version 5.29 43/134643/1 upstream/5.29
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 20 Jun 2017 00:38:26 +0000 (09:38 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 20 Jun 2017 00:38:29 +0000 (09:38 +0900)
Change-Id: Id92defee8f2f39f854d4a63afb03cb537a4eba9c
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
90 files changed:
.travis.yml
ChangeLog
TODO
configure.ac
doc/file.man
doc/magic.man
magic/Magdir/algol68 [new file with mode: 0644]
magic/Magdir/animation
magic/Magdir/apple
magic/Magdir/application [new file with mode: 0644]
magic/Magdir/apt [new file with mode: 0644]
magic/Magdir/bioinformatics
magic/Magdir/c-lang
magic/Magdir/claris
magic/Magdir/commands
magic/Magdir/compress
magic/Magdir/cups
magic/Magdir/editors
magic/Magdir/filesystems
magic/Magdir/fonts
magic/Magdir/gcc
magic/Magdir/gnu
magic/Magdir/images
magic/Magdir/jpeg
magic/Magdir/msdos
magic/Magdir/pgp
magic/Magdir/psl [new file with mode: 0644]
magic/Magdir/python
magic/Magdir/ruby
magic/Magdir/sgml
magic/Magdir/sql
magic/Makefile.am
python/magic.py
src/apprentice.c
src/ascmagic.c
src/cdf.c
src/cdf.h
src/compress.c
src/der.c
src/file.c
src/file.h
src/funcs.c
src/magic.c
src/readcdf.c
src/readelf.c
src/softmagic.c
tests/zstd-3-skippable-frames.result [new file with mode: 0644]
tests/zstd-dictionary-0.result [new file with mode: 0644]
tests/zstd-dictionary-1.result [new file with mode: 0644]
tests/zstd-dictionary-2.result [new file with mode: 0644]
tests/zstd-skippable-frame-0.result [new file with mode: 0644]
tests/zstd-skippable-frame-4.result [new file with mode: 0644]
tests/zstd-skippable-frame-8.result [new file with mode: 0644]
tests/zstd-skippable-frame-C.result [new file with mode: 0644]
tests/zstd-v0.2-FF.result [new file with mode: 0644]
tests/zstd-v0.2-FF.testfile [new file with mode: 0644]
tests/zstd-v0.3-FF.result [new file with mode: 0644]
tests/zstd-v0.3-FF.testfile [new file with mode: 0644]
tests/zstd-v0.4-FF.result [new file with mode: 0644]
tests/zstd-v0.4-FF.testfile [new file with mode: 0644]
tests/zstd-v0.5-FF.result [new file with mode: 0644]
tests/zstd-v0.5-FF.testfile [new file with mode: 0644]
tests/zstd-v0.6-FF.result [new file with mode: 0644]
tests/zstd-v0.6-FF.testfile [new file with mode: 0644]
tests/zstd-v0.7-00.result [new file with mode: 0644]
tests/zstd-v0.7-21.result [new file with mode: 0644]
tests/zstd-v0.7-21.testfile [new file with mode: 0644]
tests/zstd-v0.7-22.result [new file with mode: 0644]
tests/zstd-v0.7-22.testfile [new file with mode: 0644]
tests/zstd-v0.8-00.result [new file with mode: 0644]
tests/zstd-v0.8-01.result [new file with mode: 0644]
tests/zstd-v0.8-01.testfile [new file with mode: 0644]
tests/zstd-v0.8-02.result [new file with mode: 0644]
tests/zstd-v0.8-02.testfile [new file with mode: 0644]
tests/zstd-v0.8-03.result [new file with mode: 0644]
tests/zstd-v0.8-03.testfile [new file with mode: 0644]
tests/zstd-v0.8-16.result [new file with mode: 0644]
tests/zstd-v0.8-16.testfile [new file with mode: 0644]
tests/zstd-v0.8-20.result [new file with mode: 0644]
tests/zstd-v0.8-20.testfile [new file with mode: 0644]
tests/zstd-v0.8-21.result [new file with mode: 0644]
tests/zstd-v0.8-21.testfile [new file with mode: 0644]
tests/zstd-v0.8-22.result [new file with mode: 0644]
tests/zstd-v0.8-22.testfile [new file with mode: 0644]
tests/zstd-v0.8-23.result [new file with mode: 0644]
tests/zstd-v0.8-23.testfile [new file with mode: 0644]
tests/zstd-v0.8-F4.result [new file with mode: 0644]
tests/zstd-v0.8-F4.testfile [new file with mode: 0644]
tests/zstd-v0.8-FF.result [new file with mode: 0644]
tests/zstd-v0.8-FF.testfile [new file with mode: 0644]

index 528238508bfffa055fae85698ad5c76a6953f3a8..260264ddd413e152e6750a29592c6e53c117b7b7 100644 (file)
@@ -1,4 +1,4 @@
-# $File$
+# $File: .travis.yml,v 1.7 2016/04/26 16:24:43 glen Exp $
 
 language: c
 
@@ -19,3 +19,10 @@ script:
  - ./configure --disable-silent-rules
  - make -j4
  - make -C tests check
+
+notifications:
+ email:
+  recipients:
+   - file-tests@mx.gw.com
+  on_success: change
+  on_failure: always
index 345b32efdc39d3f865e75877a880e5a39a48398f..2b6606d2979b744940c93de777e4a4b75d27b15e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2016-10-25  10:40  Christos Zoulas <christos@zoulas.com>
+       
+       * release 5.28
+
+2016-10-24  11:20  Christos Zoulas <christos@zoulas.com>
+
+       * der getlength overflow (Jonas Wagner)
+       * multiple magic file load failure (Christoph Biedl)
+
+2016-10-17  11:26  Christos Zoulas <christos@zoulas.com>
+
+       * CDF parsing improvements (Guy Helmer)
+
+2016-07-20   7:26  Christos Zoulas <christos@zoulas.com>
+
+       * Add support for signed indirect offsets
+
+2016-07-18   7:41  Christos Zoulas <christos@zoulas.com>
+
+       * cat /dev/null | file - should print empty (Christoph Biedl)
+
+2016-07-05  15:20  Christos Zoulas <christos@zoulas.com>
+
+       * Bump string size from 64 to 96.
+
+2016-06-13  20:20  Christos Zoulas <christos@zoulas.com>
+
+       * PR/556: Fix separators on annotations.
+
 2016-06-13  19:40  Christos Zoulas <christos@zoulas.com>
 
        * release 5.28
diff --git a/TODO b/TODO
index 5c2ed49e02f110c96ae98f7c79b2e605a21ec0fd..78890cfa5ab3a462f066b15b6c52aea65fa84a0e 100644 (file)
--- a/TODO
+++ b/TODO
@@ -6,7 +6,6 @@ file, not here. More speculative material can live here.
 listed in the BUGS section of the man page had been fixed!)
 
 ---
-
 It would be nice to simplify file considerably. For example,
 reimplement the apprentice and non-pattern magic methods in Python,
 and compile the magic patterns to a giant regex (or something similar;
@@ -15,8 +14,23 @@ small amount of C is needed (because fast execution is typically only
 required for soft magic, not the more detailed information given by
 hard-wired routines). In this regard, note that hplip, which is
 BSD-licensed, has a magic reimplementation in Python.
-
+---
 Read the kerberos magic entry for more ideas.
-
+---
 Write a string merger to make magic entry sizes dynamic.
 Strings will be converted to offsets from the string table.
+---
+Programming language support, we can introduce the concept of a group
+of rules where n rules need to match before the rule is positive. This
+could require structural changes to the matching code :-(
+
+0      group   2       # require 2 matches
+# rule 1
+>0     ....
+...
+# rule 2
+>0     ....
+...
+
+christos
+
index cc407febe1c30321eaa4bbb866f66266e74324b5..da2fbbf5fbfa44403c825c767cd648af4378c26d 100644 (file)
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT([file],[5.27],[christos@astron.com])
+AC_INIT([file],[5.29],[christos@astron.com])
 AM_INIT_AUTOMAKE([subdir-objects foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
index ebf18f16bd33c2368ea5bba42900548fa5d164b7..99a9a257153772b2357f3e09d53e93856c8c6859 100644 (file)
@@ -1,5 +1,5 @@
-.\" $File: file.man,v 1.120 2016/03/31 17:51:12 christos Exp $
-.Dd March 13, 2016
+.\" $File: file.man,v 1.123 2016/06/30 14:50:55 christos Exp $
+.Dd October 19, 2016
 .Dt FILE __CSECTION__
 .Os
 .Sh NAME
@@ -8,7 +8,7 @@
 .Sh SYNOPSIS
 .Nm
 .Bk -words
-.Op Fl bcEhiklLNnprsvzZ0
+.Op Fl bcdEhiklLNnprsvzZ0
 .Op Fl Fl apple
 .Op Fl Fl extension
 .Op Fl Fl mime-encoding
@@ -181,6 +181,8 @@ Cause a checking printout of the parsed form of the magic file.
 This is usually used in conjunction with the
 .Fl m
 flag to debug a new magic file before installing it.
+.It Fl d
+Prints internal debugging information to stderr.
 .It Fl E
 On filesystem errors (file not found etc), instead of handling the error
 as regular output as POSIX mandates and keep going, issue an error message
@@ -208,7 +210,8 @@ Prints details of Compound Document Files.
 .It compress
 Checks for, and looks inside, compressed files.
 .It elf
-Prints ELF file details.
+Prints ELF file details, provided soft magic tests are enabled and the
+elf magic is found.
 .It soft
 Consults magic files.
 .It tar
@@ -312,7 +315,7 @@ attempt to preserve the access time of files analyzed, to pretend that
 never read them.
 .It Fl P , Fl Fl parameter Ar name=value
 Set various parameter limits.
-.Bl -column "elf_phnum" "Default" "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent
+.Bl -column "elf_phnum" "Default" "XXXXXXXXXXXXXXXXXXXXXXXXXXX" -offset indent
 .It Sy "Name" Ta Sy "Default" Ta Sy "Explanation"
 .It Li indir Ta 15 Ta recursion limit for indirect magic
 .It Li name Ta 30 Ta use count limit for name/use magic
index fca6f026be0fd2289390402614b5b1bff79bcbe8..040158179cd16d7d7eb8d1f52937390a0a3651d4 100644 (file)
@@ -1,5 +1,5 @@
-.\" $File: magic.man,v 1.85 2015/01/01 17:07:34 christos Exp $
-.Dd January 1, 2015
+.\" $File: magic.man,v 1.87 2016/07/20 11:27:08 christos Exp $
+.Dd July 20, 2016
 .Dt MAGIC __FSECTION__
 .Os
 .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
@@ -535,13 +535,18 @@ the file.
 The value at that offset is read, and is used again as an offset
 in the file.
 Indirect offsets are of the form:
-.Em (( x [.[bislBISL]][+\-][ y ]) .
+.Em (( x [[.,][bislBISL]][+\-][ y ]) .
 The value of
 .Em x
 is used as an offset in the file.
 A byte, id3 length, short or long is read at that offset depending on the
 .Em [bislBISLm]
 type specifier.
+The value is treated as signed if
+.Dq ,
+is specified or unsigned if
+.Dq .
+is specified.
 The capitalized types interpret the number as a big endian
 value, whereas the small letter versions interpret the number as a little
 endian value;
@@ -564,9 +569,9 @@ That way variable length structures can be examined:
 \*[Gt]\*[Gt](0x3c.l)  string  LX\e0\e0  LX executable (OS/2)
 .Ed
 .Pp
-This strategy of examining has a drawback: You must make sure that
-you eventually print something, or users may get empty output (like, when
-there is neither PE\e0\e0 nor LE\e0\e0 in the above example)
+This strategy of examining has a drawback: you must make sure that you
+eventually print something, or users may get empty output (such as when
+there is neither PE\e0\e0 nor LE\e0\e0 in the above example).
 .Pp
 If this indirect offset cannot be used directly, simple calculations are
 possible: appending
diff --git a/magic/Magdir/algol68 b/magic/Magdir/algol68
new file mode 100644 (file)
index 0000000..68583df
--- /dev/null
@@ -0,0 +1,19 @@
+
+#------------------------------------------------------------------------------
+# $File: algol68,v 1.1 2016/08/02 16:53:28 christos Exp $
+# algol68:  file(1) magic for Algol 68 source
+#
+0      search/8192     (input,                 Algol 68 source text
+!:mime text/x-Algol68
+0      regex           \^PROC                  Algol 68 source text
+!:mime text/x-Algol68
+0      regex           MODE[\t\ ]              Algol 68 source text
+!:mime text/x-Algol68
+0      regex           REF[\t\ ]               Algol 68 source text
+!:mime text/x-Algol68
+0      regex           FLEX[\t\ ]\*\\[         Algol 68 source text
+!:mime text/x-Algol68
+#0     regex           [\t\ ]OD                Algol 68 source text
+#!:mime        text/x-Algol68
+#0     regex           [\t\ ]FI                Algol 68 source text
+#!:mime        text/x-Algol68
index e283a17fea0ff8312a413cb4bc6ab3efea512224..9689dcaa1fedfd75901513ac367092ab1431d024 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: animation,v 1.56 2014/10/23 23:12:51 christos Exp $
+# $File: animation,v 1.57 2015/11/29 22:11:07 christos Exp $
 # animation:  file(1) magic for animation/movie formats
 #
 # animation formats
 >4     lelong  x       %d x
 >8     lelong  x       %d,
 >12    lelong  x       %d frames
+
+# Material Exchange Format
+# More information:
+# https://en.wikipedia.org/wiki/Material_Exchange_Format
+# http://www.freemxf.org/
+0      string  \x06\x0e\x2b\x34\x02\x05\x01\x01\x0d\x01\x02\x01\x01\x02        Material exchange container format
+!:ext  mxf
+!:mime application/mxf
index 1278d5a23041e59d0c5f0f3971ded05692fa682a..d3ecfdb5ad84e411898946391d7ead0cc8eedd51 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: apple,v 1.31 2015/08/29 07:10:35 christos Exp $
+# $File: apple,v 1.34 2016/07/18 19:23:38 christos Exp $
 # apple:  file(1) magic for Apple file formats
 #
 0      search/1/t      FiLeStArTfIlEsTaRt      binscii (apple ][) text
 # .vdi
 4      string innotek\ VirtualBox\ Disk\ Image %s
 
-# Apple disk partition stuff, strengthen the magic using byte 4
+# Apple disk partition stuff
+# URL: https://en.wikipedia.org/wiki/Apple_Partition_Map
+# Reference: https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/bootblock.h
+# Update: Joerg Jenderek 
+# "ER" is APPLE_DRVR_MAP_MAGIC signature
 0      beshort 0x4552
->4     byte    0                       Apple Driver Map
+# display Apple Driver Map (strength=50) after Syslinux bootloader (71)
+#!:strength +0
+# strengthen the magic by looking for used blocksizes 512 2048
+>2     ubeshort&0xf1FF         0       Apple Driver Map
+# last 6 bytes for padding found are 0 or end with 55AAh marker for MBR hybrid
+#>>504 ubequad&0x0000FFffFFff0000      0
+!:mime application/x-apple-diskimage
+!:apple        ????devr
+# https://en.wikipedia.org/wiki/Apple_Disk_Image
+!:ext  dmg/iso
+# sbBlkSize for driver descriptor map 512 2048
 >>2    beshort x                       \b, blocksize %d
->>4    belong  x                       \b, blockcount %d
->>10   beshort x                       \b, devtype %d
->>12   beshort x                       \b, devid %d
->>20   beshort x                       \b, descriptors %d
-# Assume       8 partitions each at a multiple of the sector size.
-# We could glean this from the partition descriptors, but they are empty!?!?
->>(2.S*1)      indirect        x       \b, contains[@0x%x]: 
->>(2.S*2)      indirect        x       \b, contains[@0x%x]: 
->>(2.S*3)      indirect        x       \b, contains[@0x%x]: 
->>(2.S*4)      indirect        x       \b, contains[@0x%x]: 
->>(2.S*5)      indirect        x       \b, contains[@0x%x]: 
->>(2.S*6)      indirect        x       \b, contains[@0x%x]: 
->>(2.S*7)      indirect        x       \b, contains[@0x%x]: 
->>(2.S*8)      indirect        x       \b, contains[@0x%x]: 
-
-# Yes, the 3rd and 4th bytes are reserved, but we use them to make the
+# sbBlkCount sometimes garbish like
+# 0xb0200000 for unzlibed install_flash_player_19.0.0.245_osx.dmg
+# 0xf2720100 for bunziped Firefox 48.0-2.dmg
+# 0xeb02ffff for super_grub2_disk_hybrid_2.02s3.iso
+# 0x00009090 by syslinux-6.03/utils/isohybrid.c
+>>4    ubelong x                       \b, blockcount %u
+# following device/driver information not very useful
+# device type 0 1 (37008 garbage for super_grub2_disk_hybrid_2.02s3.iso)
+>>8    ubeshort        x               \b, devtype %u
+# device id 0 1 (37008 garbage for super_grub2_disk_hybrid_2.02s3.iso)
+>>10   ubeshort        x               \b, devid %u
+# driver data 0 (2425393296 garbage for super_grub2_disk_hybrid_2.02s3.iso)
+>>12   ubelong         >0              
+>>>12  ubelong         x               \b, driver data %u
+# number of driver descriptors sbDrvrCount <= 61
+# (37008 garbage for super_grub2_disk_hybrid_2.02s3.iso)
+>>16   ubeshort        x               \b, driver count %u
+# 61 * apple_drvr_descriptor[8]. information not very useful or same as in partition map
+# >>18 use             apple-driver-map
+# >>26 use             apple-driver-map
+# # ...
+# >>500        use             apple-driver-map
+# number of partitions is always same in every partition (map block count)
+#>>0x0204      ubelong         x       \b, %u partitions
+>>0x0204       ubelong         >0      \b, contains[@0x200]: 
+>>>0x0200      use             apple-apm
+>>0x0204       ubelong         >1      \b, contains[@0x400]: 
+>>>0x0400      use             apple-apm
+>>0x0204       ubelong         >2      \b, contains[@0x600]: 
+>>>0x0600      use             apple-apm
+>>0x0204       ubelong         >3      \b, contains[@0x800]: 
+>>>0x0800      use             apple-apm
+>>0x0204       ubelong         >4      \b, contains[@0xA00]: 
+>>>0x0A00      use             apple-apm
+>>0x0204       ubelong         >5      \b, contains[@0xC00]: 
+>>>0x0C00      use             apple-apm
+>>0x0204       ubelong         >6      \b, contains[@0xE00]: 
+>>>0x0E00      use             apple-apm
+>>0x0204       ubelong         >7      \b, contains[@0x1000]: 
+>>>0x1000      use             apple-apm
+#      display apple driver descriptor map (start-block, # blocks in sbBlkSize sizes, type)
+0      name                            apple-driver-map
+>0     ubequad         !0              
+# descBlock first block of driver 
+>>0    ubelong x                       \b, driver start block %u
+# descSize driver size in blocks
+>>4    ubeshort        x               \b, size %u
+# descType driver system type 1 701h F8FFh FFFFh
+>>6    ubeshort        x               \b, type 0x%x
+
+# URL: https://en.wikipedia.org/wiki/Apple_Partition_Map
+# Reference: http://opensource.apple.com/source/IOStorageFamily/IOStorageFamily-116/IOApplePartitionScheme.h
+# Update: Joerg Jenderek 
+# Yes, the 3rd and 4th bytes pmSigPad are reserved, but we use them to make the
 # magic stronger.
-0      belong  0x504d0000              Apple Partition Map
->4     belong  x                       \b, map block count %d
->8     belong  x                       \b, start block %d
->12    belong  x                       \b, block count %d
->16    string >0                       \b, name %s
->48    string >0                       \b, type %s
->124   string >0                       \b, processor %s
->140   string >0                       \b, boot arguments %s
->92    belong  & 1                     \b, valid
->92    belong  & 2                     \b, allocated
->92    belong  & 4                     \b, in use
->92    belong  & 8                     \b, has boot info
->92    belong  & 16                    \b, readable
->92    belong  & 32                    \b, writable
->92    belong  & 64                    \b, pic boot code
->92    belong  & 128                   \b, chain compatible driver
->92    belong  & 256                   \b, real driver
->92    belong  & 512                   \b, chain driver
->92    belong  & 1024                  \b, mount at startup
->92    belong  & 2048                  \b, is the startup partition
-
-#http://wiki.mozilla.org/DS_Store_File_Format`
+# for apple partition map stored as a single file
+0      belong  0x504d0000              
+# to display Apple Partition Map (strength=70) after Syslinux bootloader (71)
+#!:strength +0
+>0     use             apple-apm
+# magic/Magdir/apple14.test, 365: Warning: Current entry does not yet have a description for adding a EXTENSION type
+# file: could not find any valid magic files!
+#!:ext bin
+#      display apple partition map. Normally called after Apple driver map
+0      name                            apple-apm
+>0     belong  0x504d0000              Apple Partition Map
+# number of partitions
+>>4    ubelong x                       \b, map block count %u
+# logical block (512 bytes) start of partition
+>>8    ubelong x                       \b, start block %u
+>>12   ubelong x                       \b, block count %u
+>>16   string >0                       \b, name %s
+>>48   string >0                       \b, type %s
+# processor type dpme_process_id[16] e.g. "68000" "68020"
+>>120  string >0                       \b, processor %s
+# A/UX boot arguments BootArgs[128]
+>>136  string >0                       \b, boot arguments %s
+# status of partition dpme_flags
+>>88   belong  & 1                     \b, valid
+>>88   belong  & 2                     \b, allocated
+>>88   belong  & 4                     \b, in use
+>>88   belong  & 8                     \b, has boot info
+>>88   belong  & 16                    \b, readable
+>>88   belong  & 32                    \b, writable
+>>88   belong  & 64                    \b, pic boot code
+>>88   belong  & 128                   \b, chain compatible driver
+>>88   belong  & 256                   \b, real driver
+>>88   belong  & 512                   \b, chain driver
+# mount automatically at startup APPLE_PS_AUTO_MOUNT
+>>88   ubelong &0x40000000             \b, mount at startup
+# is the startup partition APPLE_PS_STARTUP
+>>88   ubelong &0x80000000             \b, is the startup partition
+
+#http://wiki.mozilla.org/DS_Store_File_Format
 #http://en.wikipedia.org/wiki/.DS_Store
 0      string  \0\0\0\1Bud1\0          Apple Desktop Services Store
 
 # extensions rsr/rsrc
 0      string  \000\000\001\000
 >4     leshort 0
->>16    lelong  0                      Apple HFS/HFS+ resource fork
-
+>>16   lelong  0                       Apple HFS/HFS+ resource fork
+
+#https://en.wikipedia.org/wiki/AppleScript
+0      string  FasdUAS                 AppleScript compiled
+
+# AppleWorks/ClarisWorks
+# https://github.com/joshenders/appleworks_format
+# http://fileformats.archiveteam.org/wiki/AppleWorks
+0      name                    appleworks
+>0     belong&0x00ffffff       0x07e100        AppleWorks CWK Document
+>0     belong&0x00ffffff       0x008803        ClarisWorks CWK Document
+>0     default                 x       
+>>0    belong                  x               AppleWorks/ClarisWorks CWK Document
+>0     byte                    x               \b, version %d
+>30    beshort                 x               \b, %d
+>32    beshort                 x               \bx%d
+!:ext cwk
+
+4      string  BOBO
+>0     byte    >4
+>>12   belong  0
+>>>26  belong  0
+>>>>0  use     appleworks
+>0     belong  0x0481ad00
+>>0    use     appleworks
diff --git a/magic/Magdir/application b/magic/Magdir/application
new file mode 100644 (file)
index 0000000..ea30347
--- /dev/null
@@ -0,0 +1,7 @@
+
+#------------------------------------------------------------------------------
+# $File: apple,v 1.35 2016/08/17 09:45:13 christos Exp $
+# application:  file(1) magic for applications on small devices
+#
+# Pebble Application
+0      string  PBLAPP\000\000  Pebble application
diff --git a/magic/Magdir/apt b/magic/Magdir/apt
new file mode 100644 (file)
index 0000000..26fb3bd
--- /dev/null
@@ -0,0 +1,52 @@
+
+#------------------------------------------------------------------------------
+# $File: apple,v 1.35 2016/08/17 09:45:13 christos Exp $
+# apt: file(1) magic for APT Cache files
+# <http://www.fifi.org/doc/libapt-pkg-doc/cache.html/ch2.html>
+# <https://anonscm.debian.org/cgit/apt/apt.git/tree/apt-pkg/pkgcache.h#n292>
+
+# before version 10 ("old format"), data was in arch-specific long/short
+
+# old format 64 bit
+0      name            apt-cache-64bit-be
+>12    beshort         1               \b, dirty
+>40    bequad          x               \b, %llu packages
+>48    bequad          x               \b, %llu versions
+
+# old format 32 bit
+0      name            apt-cache-32bit-be
+>8     beshort         1               \b, dirty
+>40    belong          x               \b, %u packages
+>44    belong          x               \b, %u versions
+
+# new format
+0      name            apt-cache-be
+>6     byte            1               \b, dirty
+>24    belong          x               \b, %u packages
+>28    belong          x               \b, %u versions
+
+0      bequad          0x98FE76DC
+>8     ubeshort        <10             APT cache data, version %u
+>>10   beshort         x               \b.%u, 64 bit big-endian
+>>0    use             apt-cache-64bit-be
+
+0      lequad          0x98FE76DC
+>8     uleshort        <10             APT cache data, version %u
+>>10   leshort         x               \b.%u, 64 bit little-endian
+>>0    use             \^apt-cache-64bit-be
+
+0      belong          0x98FE76DC
+>4     ubeshort        <10             APT cache data, version %u
+>>6    ubeshort        x               \b.%u, 32 bit big-endian
+>>0    use             apt-cache-32bit-be
+>4     ubyte           >9              APT cache data, version %u
+>>5    ubyte           x               \b.%u, big-endian
+>>0    use             apt-cache-be
+
+0      lelong          0x98FE76DC
+>4     uleshort        <10             APT cache data, version %u
+>>6    uleshort        x               \b.%u, 32 bit little-endian
+>>0    use             \^apt-cache-32bit-be
+>4     ubyte           >9              APT cache data, version %u
+>>5    ubyte           x               \b.%u, little-endian
+>>0    use             \^apt-cache-be
index 91b404bf6dc900a894659554d330e4d6997d314d..8478863079f78c2fe35d33aff08b81d9ed1f40cd 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: bioinformatics,v 1.1 2016/02/14 15:32:22 christos Exp $
+# $File: bioinformatics,v 1.3 2016/06/20 16:13:14 christos Exp $
 # bioinfomatics:  file(1) magic for Bioinfomatics file formats
 
 ###############################################################################
 
 
 ###############################################################################
-# Tabix index file 
+# Tabix index file
 # used by SAMtools bgzip/tabix (http://samtools.sourceforge.net/tabix.shtml)
 ###############################################################################
 0      string  TBI\1           SAMtools TBI (Tabix index format)
 >0x04  lelong  =1              \b, with %d reference sequence
 >0x04  lelong  >1              \b, with %d reference sequences
 >0x08  lelong  &0x10000        \b, using half-closed-half-open coordinates (BED style)
->0x08  lelong  ^0x10000        
+>0x08  lelong  ^0x10000
 >>0x08 lelong  =0              \b, using closed and one based coordinates (GFF style)
 >>0x08 lelong  =1              \b, using SAM format
 >>0x08 lelong  =2              \b, using VCF format
 >0x0c  lelong  x               \b, sequence name column: %d
 >0x10  lelong  x               \b, region start column: %d
->0x08  lelong  =0              
+>0x08  lelong  =0
 >>0x14 lelong  x               \b, region end column: %d
 >0x18  byte    x               \b, comment character: %c
 >0x1c  lelong  x               \b, skip line count: %d
 
 
 ###############################################################################
-# BAM (Binary Sequence Alignment/Map format) 
-# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf) 
+# BAM (Binary Sequence Alignment/Map format)
+# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
 # data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
 ###############################################################################
 0      string  BAM\1   SAMtools BAM (Binary Sequence Alignment/Map)
->0x04  lelong  >0      
+>0x04  lelong  >0
 >>&0x00 regex  =^[@]HD\t.*VN:          \b, with SAM header
 >>>&0  regex   =[0-9.]+                \b version %s
 >>&(0x04)      lelong  >0      \b, with %d reference sequences
 
 ###############################################################################
 # BAI (BAM indexing format)
-# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf) 
+# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
 ###############################################################################
 0              string  BAI\1   SAMtools BAI (BAM indexing format)
 >0x04          lelong  >0      \b, with %d reference sequences
 
 
 ###############################################################################
-# CRAM (Binary Sequence Alignment/Map format) 
+# CRAM (Binary Sequence Alignment/Map format)
 ###############################################################################
 0      string  CRAM    CRAM
 >0x04  byte    >-1     version %d.
 # used by SAMtools & VCFtools (http://vcftools.sourceforge.net/bcf.pdf)
 # data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
 ###############################################################################
-0              string     BCF\4    
+0              string     BCF\4
 # length of seqnm data in bytes is positive
->&0x00         lelong    >0    
+>&0x00         lelong    >0
 # length of smpl data in bytes is positive
 >>&(&-0x04)    lelong    >0                    SAMtools BCF (Binary Call Format)
 # length of meta in bytes
->>>&(&-0x04)   lelong    >0    
+>>>&(&-0x04)   lelong    >0
 # have meta text string
 >>>>&0x00      search    ##samtoolsVersion=
 >>>>>&0x00     string    x                     \b, generated by SAMtools version %s
@@ -88,7 +88,7 @@
 ###############################################################################
 0              string     BCF\2\1    Binary Call Format (BCF) version 2.1
 # length of header text
->&0x00         lelong    >0    
+>&0x00         lelong    >0
 # have header string
 >>&0x00 search   ##samtoolsVersion=
 >>>&0x00       string    x                     \b, generated by SAMtools version %s
 ###############################################################################
 0              string     BCF\2\2    Binary Call Format (BCF) version 2.2
 # length of header text
->&0x00         lelong    >0    
+>&0x00         lelong    >0
 # have header string
 >>&0x00 search   ##samtoolsVersion=
 >>>&0x00       string    x                     \b, generated by SAMtools version %s
 ###############################################################################
 # XXX Broken?
 # @<seqname>
-#0     regex   =^@[A-Za-z0-9_.:-]+\?\n 
+#0     regex   =^@[A-Za-z0-9_.:-]+\?\n
 # <seq>
 #>&1   regex   =^[A-Za-z\n.~]++
 # +[<seqname>]
-#>>&1  regex   =^[A-Za-z0-9_.:-]*\?\n  
+#>>&1  regex   =^[A-Za-z0-9_.:-]*\?\n
 # <qual>
 #>>>&1 regex   =^[!-~\n]+\n            FASTQ
 
 # used by FASTA (http://fasta.bioch.virginia.edu/fasta_www2/fasta_guide.pdf)
 ###############################################################################
 #0     byte    0x3e
-# q>0  regex   =^[>][!-~\t\ ]+$        
+# q>0  regex   =^[>][!-~\t\ ]+$
 # Amino Acid codes: [A-IK-Z*-]+
 #>>1   regex   !=[!-'Jj;:=?@^`|~\\]            FASTA
 # IUPAC codes/gaps: [ACGTURYKMSWBDHVNX-]+
 #>>>1  regex   =^[EFIJLOPQZefijlopqz]+$        \b, with Amino Acid codes
 
 ###############################################################################
-# SAM (Sequence Alignment/Map format) 
-# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf) 
+# SAM (Sequence Alignment/Map format)
+# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
 ###############################################################################
 # Short-cut version to recognise SAM files with (optional) header at beginning
 ###############################################################################
-0      string     @HD\t        
+0      string     @HD\t
 >4     search     VN:          Sequence Alignment/Map (SAM), with header
 >>&0   regex      [0-9.]+      \b version %s
 ###############################################################################
 # Longer version to recognise SAM alignment lines using (many) regexes
 ###############################################################################
 # SAM Alignment QNAME
-0              regex   =^[!-?A-~]{1,255}(\t[^\t]+){11}         
+0              regex   =^[!-?A-~]{1,255}(\t[^\t]+){11}
 # SAM Alignment FLAG
->0             regex   =^([^\t]+\t){1}[0-9]{1,5}\t             
+>0             regex   =^([^\t]+\t){1}[0-9]{1,5}\t
 # SAM Alignment RNAME
->>0            regex   =^([^\t]+\t){2}\\*|[^*=]*\t             
+>>0            regex   =^([^\t]+\t){2}\\*|[^*=]*\t
 # SAM Alignment POS
->>>0           regex   =^([^\t]+\t){3}[0-9]{1,9}\t             
+>>>0           regex   =^([^\t]+\t){3}[0-9]{1,9}\t
 # SAM Alignment MAPQ
->>>>0          regex   =^([^\t]+\t){4}[0-9]{1,3}\t             
+>>>>0          regex   =^([^\t]+\t){4}[0-9]{1,3}\t
 # SAM Alignment CIGAR
->>>>>0         regex   =\t\\*|([0-9]+[MIDNSHPX=])+)\t          
+>>>>>0         regex   =\t(\\*|([0-9]+[MIDNSHPX=])+)\t
 # SAM Alignment RNEXT
->>>>>>0                regex   =\t(\\*|=|[!-()+->?-~][!-~]*)\t         
+>>>>>>0                regex   =\t(\\*|=|[!-()+->?-~][!-~]*)\t
 # SAM Alignment PNEXT
->>>>>>>0       regex   =^([^\t]+\t){7}[0-9]{1,9}\t             
+>>>>>>>0       regex   =^([^\t]+\t){7}[0-9]{1,9}\t
 # SAM Alignment TLEN
->>>>>>>>0      regex   =\t[+-]{0,1}[0-9]{1,9}\t.*\t            
+>>>>>>>>0      regex   =\t[+-]{0,1}[0-9]{1,9}\t.*\t
 # SAM Alignment SEQ
->>>>>>>>>0     regex   =^([^\t]+\t){9}(\\*|[A-Za-z=.]+)\t      
+>>>>>>>>>0     regex   =^([^\t]+\t){9}(\\*|[A-Za-z=.]+)\t
 # SAM Alignment QUAL
 >>>>>>>>>>0    regex   =^([^\t]+\t){10}[!-~]+  Sequence Alignment/Map (SAM)
 >>>>>>>>>>>0   regex   =^[@]HD\t.*VN:          \b, with header
index 10140f8cad2e3317efbf82d329b1e615c44c1920..20006be5d6fa96313f7ddea97a305aa31a12716b 100644 (file)
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: c-lang,v 1.22 2015/10/29 18:49:11 christos Exp $
+# $File: c-lang,v 1.23 2016/05/21 14:28:27 christos Exp $
 # c-lang:  file(1) magic for C and related languages programs
 #
 # The strength is to beat standard HTML
 !:strength + 30
 !:mime text/x-c++
 
+# Objective-C
+0      regex   \^#import       Objective-C source text
+!:strength +25
+!:mime text/x-objective-c
+
 # From: Mikhail Teterin <mi@aldan.algebra.com> 
 0      string          cscope          cscope reference data
 >7     string          x               version %.2s
index 803de6064730438c886f96efaa579c8f69eb7921..771190f505b9fc0f2f27dd75ec9d137dc0ea1da5 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: claris,v 1.6 2012/06/20 21:19:05 christos Exp $
+# $File: claris,v 1.7 2014/06/03 19:17:27 christos Exp $
 # claris:  file(1) magic for claris
 # "H. Nanosecond" <aldomel@ix.netcom.com>
 # Claris Works a word processor, etc.
@@ -18,7 +18,8 @@
 
 # Claris works files
 # .cwk
-0      string  \002\000\210\003\102\117\102\117\000\001\206 Claris works document
+# Moved to Apple AppleWorks document
+#0     string  \002\000\210\003\102\117\102\117\000\001\206 Claris works document
 # .plt
 0      string  \020\341\000\000\010\010        Claris Works palette files .plt
 
index fddb76415d2afb1601d873b3b9b96002d7ca270e..b5daeea52d37cc3c3de6fd6f7b2698d69ea79f3c 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: commands,v 1.53 2016/02/23 12:35:20 christos Exp $
+# $File: commands,v 1.55 2016/07/10 12:44:24 christos Exp $
 # commands:  file(1) magic for various shells and interpreters
 #
 #0     string/w        :                       shell archive or script for antique kernel text
 # URL:  http://packages.debian.org/pdmenu
 # From: Edward Betts <edward@debian.org>
 0      string          #!/usr/bin/pdmenu       Pdmenu configuration file text
+
+# From Danny Weldon
+0      string  \x0b\x13\x08\x00
+>0x04   uleshort       <4      ksh byte-code version %d
index 23c67ae54268bcfb71eb271ef83536b3dbdf0fa8..8d790f7af0adb20fb59ecd66df36553c18bc086e 100644 (file)
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: compress,v 1.64 2015/07/27 15:41:09 christos Exp $
+# $File: compress,v 1.65 2015/12/04 20:48:03 christos Exp $
 # compress:  file(1) magic for pure-compression formats (no archives)
 #
 # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
 0      lelong          0x184c2102      LZ4 compressed data (v0.1-v0.9)
 !:mime application/x-lz4
 
+# Zstandard/LZ4 skippable frames
+# https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md
+0         lelong&0xFFFFFFF0  0x184D2A50
+>(4.l+8)  indirect
+
+# Zstandard Dictionary ID subroutine
+0     name        zstd-dictionary-id
+# Single Segment = True
+>0    byte        &0x20   \b, Dictionary ID:
+>>0   byte&0x03   0       None
+>>0   byte&0x03   1
+>>>1  byte        x       %u
+>>0   byte&0x03   2
+>>>1  leshort     x       %u
+>>0   byte&0x03   3
+>>>1  lelong      x       %u
+# Single Segment = False
+>0    byte        ^0x20   \b, Dictionary ID:
+>>0   byte&0x03   0       None
+>>0   byte&0x03   1
+>>>2  byte        x       %u
+>>0   byte&0x03   2
+>>>2  leshort     x       %u
+>>0   byte&0x03   3
+>>>2  lelong      x       %u
+
+# Zstandard compressed data
+# https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md
+0     lelong       0xFD2FB522  Zstandard compressed data (v0.2)
+!:mime  application/x-zstd
+0     lelong       0xFD2FB523  Zstandard compressed data (v0.3)
+!:mime  application/x-zstd
+0     lelong       0xFD2FB524  Zstandard compressed data (v0.4)
+!:mime  application/x-zstd
+0     lelong       0xFD2FB525  Zstandard compressed data (v0.5)
+!:mime  application/x-zstd
+0     lelong       0xFD2FB526  Zstandard compressed data (v0.6)
+!:mime  application/x-zstd
+0     lelong       0xFD2FB527  Zstandard compressed data (v0.7)
+!:mime  application/x-zstd
+>4    use          zstd-dictionary-id
+0     lelong       0xFD2FB528  Zstandard compressed data (v0.8+)
+!:mime  application/x-zstd
+>4    use          zstd-dictionary-id
+
+# https://github.com/facebook/zstd/blob/dev/zstd_compression_format.md
+0  lelong    0xEC30A437  Zstandard dictionary
+!:mime  application/x-zstd-dictionary
+>4 lelong    x           (ID %u)
+
 # AFX compressed files (Wolfram Kleff)
 2      string          -afx-           AFX compressed file data
 
index e71da87288fd6109688e3fa79157e756e3ec9e4c..59536c25609a27f4e1edd390e28b6ddb528f171a 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: cups,v 1.2 2012/11/02 21:50:29 christos Exp $
+# $File: cups,v 1.3 2014/05/28 19:50:41 christos Exp $
 # Cups: file(1) magic for the cups raster file format
 # From: Laurent Martelli <martellilaurent@gmail.com>
 # http://www.cups.org/documentation.php/spec-raster.html
@@ -44,7 +44,7 @@
 >3     string          2               Cups Raster version 2, Big Endian
 >3     string          3               Cups Raster version 3, Big Endian
 !:mime application/vnd.cups-raster
->0     use             ^cups-le
+>0     use             \^cups-le
 
 
 # Cups Raster image format, Little Endian
index 2049fb5fae1698d07d9415ce422810c66a78d7e6..5d87d2bd48f70bb5f8e080e48024ebadcdc3ddc8 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File$
+# $File: editors,v 1.9 2016/07/18 11:55:11 christos Exp $
 # T602 editor documents 
 # by David Necas <yeti@physics.muni.cz>
 0      string  @CT\    T602 document data,
 # Vi IMproved Encrypted file 
 # by David Necas <yeti@physics.muni.cz>
 0      string  VimCrypt~       Vim encrypted file data
+
+0      name    vimnanoswap
+>67    byte    0
+>>107  byte    0
+#>>>2  string  x       %s swap file
+>>>24  ulelong x       \b, pid %d
+>>>28  string  >\0     \b, user %s
+>>>68  string  >\0     \b, host %s
+>>>108 string  >\0     \b, file %s
+>>>1007        byte    0x55    \b, modified
+
 # Vi IMproved Swap file
 # by Sven Wegener <swegener@gentoo.org>
-0      string  b0VIM\          Vim swap file
->&0    string  >\0             \b, version %s
+0      string  b0VIM\          Vim swap file
+>&0    string  >\0             \b, version %s
+>0     use     vimnanoswap
+
+
+# Lock/swap file for several editors, at least
+# Vi IMproved and nano
+0      string  b0nano          Nano swap file
+>0     use     vimnanoswap
+
+# kate (K Advanced Text Editor)
+0      string  \x00\x00\x00\x12Kate\ Swap\ File\ 2.0\x00       Kate swap file
index ce2d42d494e0861d53f22f08b9c2b96be4e4a478..1e8e8a8aa405c97e79e9fc0e10c7c0adc64f4446 100644 (file)
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: filesystems,v 1.112 2016/01/11 21:16:37 christos Exp $
+# $File: filesystems,v 1.113 2016/02/14 14:38:24 christos Exp $
 # filesystems:  file(1) magic for different filesystems
 #
 0      name    partid  
 >>>514         string          !HdrS                   
 # not BeOS
 >>>>422                string          !Be\ Boot\ Loader       
->>>>>32769     string    CD001
->>>>>>0        use cdrom
 # jump over BPB instruction implies DOS bootsector or AdvanceMAME mbr 
 >>>>>0         ubelong&0xFD000000      =0xE9000000     
 # AdvanceMAME mbr
 >>38917        string    3         (version 2.0)
 >>38917        byte     >0x33      (unknown version, ID 0x%X)
 >>38917        byte     <0x31      (unknown version, ID 0x%X)
+# The next line is not necessary because the MBR staff is done looking for boot signature
 >0x1FE leshort  0xAA55     (DOS/MBR boot sector)
 # "application id" which appears to be used as a volume label
 >32808 string/T  >\0       '%s'
index 5e2b66ca81d5e85991ab2e6a2d78f6c8b0b34cb3..dc110de1f0da6124d56c9d6aa3440e998bbd3f41 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: fonts,v 1.29 2016/02/08 17:06:40 christos Exp $
+# $File: fonts,v 1.32 2016/07/03 14:13:11 christos Exp $
 # fonts:  file(1) magic for font data
 #
 0      search/1        FONT            ASCII vfont text
 6      string          %!FontType1     PostScript Type 1 font program data
 0      string          %!PS-Adobe-3.0\ Resource-Font   PostScript Type 1 font text
 
+# Summary:     PostScript Type 1 Printer Font Metrics
+# URL:         https://en.wikipedia.org/wiki/PostScript_fonts
+# Reference:   http://partners.adobe.com/public/developer/en/font/5178.PFM.pdf
+# Modified by: Joerg Jenderek
+# Note:                moved from ./msdos magic 
+# dfVersion 256=0100h 
+0              uleshort        0x0100          
+# GRR: line above is too general as it catches also TrueType font,
+# raw G3 data FAX, WhatsApp encrypted and Panorama database
+# dfType 129=0081h
+>66            uleshort        0x0081          
+# dfVertRes 300=012Ch not needed as additional test
+#>>70          uleshort        0x012c          
+# dfHorizRes 300=012Ch
+#>>>72         uleshort        0x012c          
+# dfDriverInfo points to postscript information section
+>>(101.l)      string/c        Postscript      Printer Font Metrics
+# above labeled "PFM data" by ./msdos (version 5.28) or "Adobe Printer Font Metrics" by TrID
+!:mime application/x-font-pfm
+# AppleShare Print Server
+#!:apple       ASPS????
+!:ext  pfm
+# dfCopyright 60 byte null padded Copyright string. uncomment it to get old looking
+#>>>6          string          >\060           - %-.60s
+# dfDriverInfo
+>>>139         ulelong         >0              
+# often abbreviated and same as filename
+>>>>(139.l)    string          x               %s
+# dfSize
+>>>2           ulelong         x               \b, %d bytes
+# dfFace 210=D2h 9Eh
+>>>105         ulelong         >0              
+# Windows font name
+>>>>(105.l)    string          x               \b, %s
+# dfItalic
+>>>80          ubyte           1               italic
+# dfUnderline
+>>>81          ubyte           1               underline
+# dfStrikeOut
+>>>82          ubyte           1               strikeout
+# dfWeight 400=0x0190 300=0x012c 500=0x01f4 600=0x0258 700=0x02bc
+>>>83          uleshort        >699            bold
+# dfPitchAndFamily 16 17 48 49 64 65
+>>>90          ubyte           16              serif
+>>>90          ubyte           17              serif proportional
+#>>>90         ubyte           48              other
+>>>90          ubyte           49              proportional
+>>>90          ubyte           64              script
+>>>90          ubyte           65              script proportional
+
 # X11 font files in SNF (Server Natural Format) format
 # updated by Joerg Jenderek at Feb 2013
 # http://computer-programming-forum.com/51-perl/8f22fb96d2e34bab.htm
 >14    string          x               version %s
 
 # EOT
-34     string          LP              Embedded OpenType (EOT)
+0x40   string          \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
+>0x22  string          LP              Embedded OpenType (EOT)
+# workaround until there's lepstring16
+# >>0x52       lepstring16/h   >\0             \b, %s family
+>>0x52 short   !0
+>>>0x54        lestring16      x               \b, %s family
 !:mime application/vnd.ms-fontobject
 
 # Web Open Font Format (.woff)
index ecc9b42d9d6f2ebf6fa01d7996b71b04608f8c5e..9ddbb47f0620038c14d630c24201e847a98135a4 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File$
+# $File: gcc,v 1.4 2009/09/19 16:28:09 christos Exp $
 # gcc:  file(1) magic for GCC special files
 #
 0      string          gpch            GCC precompiled header
@@ -12,6 +12,6 @@
 
 # 67 = 'C', 111 = 'o', 43 = '+', 79 = 'O'
 >4     byte            67                      for C
->4     byte            111                     for Objective C
+>4     byte            111                     for Objective-C
 >4     byte            43                      for C++
->4     byte            79                      for Objective C++
+>4     byte            79                      for Objective-C++
index 03eb093c772916ecc55885c89dbefcf3457d8749..52e6829b87b31051d7ca91a0463a87a902c8f225 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: gnu,v 1.15 2014/02/06 14:21:02 christos Exp $
+# $File: gnu,v 1.16 2015/04/19 22:59:25 christos Exp $
 # gnu:  file(1) magic for various GNU tools
 #
 # GNU nlsutils message catalog file format
 
 # This magic is not particularly good, as the keyrings don't have true
 # magic. Nevertheless, it covers many keyrings.
-0       beshort         0x9901                  GPG key public ring
-!:mime application/x-gnupg-keyring
+0      ubeshort-0x9901 <2
+>3     byte            4
+>>4    bedate          x               GPG key public ring, created %s
+!:mime application/x-gnupg-keyring
+
 
 # Symmetric encryption
 0      leshort         0x0d8c
index d25e34820a6d30745bbb935c9c112015cf3ceaa5..41c6cd6190334b5c286dd13395de461a8da4a036 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: images,v 1.115 2016/03/16 14:41:39 christos Exp $
+# $File: images,v 1.116 2016/03/23 15:29:20 christos Exp $
 # images:  file(1) magic for image formats (see also "iff", and "c-lang" for
 # XPM bitmaps)
 #
 >>>&0  regex           =[0-9]{1,50}                    \b %s
 
 0      search/1        P1              
->0     use             netpbm
->>0    string          x       \b, bitmap
+>0     regex/4         P1\\s
+>>0    use             netpbm
+>>>0   string          x       \b, bitmap
 !:strength + 45
 !:mime image/x-portable-bitmap
 
 0      search/1        P2              
->0     use             netpbm
->>0    string          x       \b, greymap
+>0     regex/4         P2\\s
+>>0    use             netpbm
+>>>0   string          x       \b, greymap
 !:strength + 45
 !:mime image/x-portable-greymap
 
 0      search/1        P3
->0     use             netpbm
->>0    string          x       \b, pixmap
+>0     regex/4         P3\\s
+>>0    use             netpbm
+>>>0   string          x       \b, pixmap
 !:strength + 45
 !:mime image/x-portable-pixmap
 
 0      string          P4              
->0     use             netpbm
->>0    string          x       \b, rawbits, bitmap
+>0     regex/4         P4\\s
+>>0    use             netpbm
+>>>0   string          x       \b, rawbits, bitmap
 !:strength + 45
 !:mime image/x-portable-bitmap
 
 0      string          P5              
->0     use             netpbm
->>0    string          x       \b, rawbits, greymap
+>0     regex/4         P5\\s
+>>0    use             netpbm
+>>>0   string          x       \b, rawbits, greymap
 !:strength + 45
 !:mime image/x-portable-greymap
 
 0      string          P6              
->0     use             netpbm
->>0    string          x       \b, rawbits, pixmap
+>0     regex/4         P6\\s
+>>0    use             netpbm
+>>>0   string          x       \b, rawbits, pixmap
 !:strength + 45
 !:mime image/x-portable-pixmap
 
index e6a4ffa0f04b5587508ee756fe8cefd9183fa30d..5650b149065313480970fc47e813e88f09f24b1e 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: jpeg,v 1.28 2015/04/09 20:01:40 christos Exp $
+# $File: jpeg,v 1.29 2015/04/10 15:36:02 christos Exp $
 # JPEG images
 # SunOS 5.5.1 had
 #
 # From: Mathieu Malaterre <mathieu.malaterre@gmail.com>
 0      belong          0xff4fff51                                              JPEG 2000 codestream
 45     beshort         0xff52
+
+# JPEG extended range
+0      string          \x49\x49\xbc
+>3     byte            1
+>>4    lelong%2        0       JPEG-XR
+!:mime image/jxr
+!:ext  jxr
index af851581a8d599cda4850a906e737aec41ae17a1..b4bf64359b390bfd1d36fcc9307b8af8590cab74 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: msdos,v 1.105 2016/03/03 18:58:14 christos Exp $
+# $File: msdos,v 1.110 2016/09/11 14:49:54 christos Exp $
 # msdos:  file(1) magic for MS-DOS files
 #
 
 0      string  \xffKEYB\ \ \ \0\0\0\0  
 >12    string  \0\0\0\0`\004\360       MS-DOS KEYBoard Layout file
 
-# .COM formats (Daniel Quinlan, quinlan@yggdrasil.com)
-# Uncommenting only the first two lines will cover about 2/3 of COM files,
-# but it isn't feasible to match all COM files since there must be at least
-# two dozen different one-byte "magics".
-# test too generic ?
-0      byte            0xe9            DOS executable (COM)
->0x1FE leshort         0xAA55          \b, boot code
->6     string          SFX\ of\ LHarc  (%s)
-
 # DOS device driver updated by Joerg Jenderek at May 2011
 # http://maben.homeip.net/static/S100/IBM/software/DOS/DOS%20techref/CHAPTER.009
 0      ulequad&0x07a0ffffffff          0xffffffff              DOS executable (
 # byte 0xeb conflicts with "sequent" magic leshort 0xn2eb
 0      ubeshort&0xeb8d >0xeb00         
 # DR-DOS STACKER.COM SCREATE.SYS missed
->0     byte            0xeb
->>0x1FE leshort                0xAA55          DOS executable (COM), boot code
->>85   string          UPX             DOS executable (COM), UPX compressed
->>4    string          \ $ARX          DOS executable (COM), ARX self-extracting archive
->>4    string          \ $LHarc        DOS executable (COM), LHarc self-extracting archive
->>0x20e string         SFX\ by\ LARC   DOS executable (COM), LARC self-extracting archive
+
+0       name    msdos-com
+>0  byte        x               DOS executable (COM)
+>6     string          SFX\ of\ LHarc  \b, %s
+>0x1FE leshort 0xAA55              \b, boot code
+>85    string          UPX                     \b, UPX compressed
+>4     string          \ $ARX              \b, ARX self-extracting archive
+>4     string          \ $LHarc            \b, LHarc self-extracting archive
+>0x20e string  SFX\ by\ LARC   \b, LARC self-extracting archive
+
+# JMP 8bit
+0              byte    0xeb
+# allow forward jumps only
+>1          byte    >-1
+# that offset must be accessible
+>>(1.b+2)   byte    x
+>>>0        use msdos-com
+
+# JMP 16bit
+0           byte    0xe9
+# forward jumps
+>1          short   >-1
+# that offset must be accessible
+>>(1.s+3)   byte    x
+>>>0        use msdos-com
+# negative offset, must not lead into PSP
+>1          short   <-259
+# that offset must be accessible
+>>(1,s+65539)   byte    x
+>>>0        use msdos-com
+
 # updated by Joerg Jenderek at Oct 2008,2015
 # following line is too general
 0      ubyte           0xb8            
 0      string/b        \x09\x04\x06\x00\x00\x00\x10\x00        Microsoft Excel Worksheet
 !:mime application/vnd.ms-excel
 #
-0      belong  0x00001a00      Lotus 1-2-3
-!:mime application/x-123
->4     belong  0x00100400      wk3 document data
->4     belong  0x02100400      wk4 document data
->4     belong  0x07800100      fm3 or fmb document data
->4     belong  0x07800000      fm3 or fmb document data
+# Update: Joerg Jenderek
+# URL: https://en.wikipedia.org/wiki/Lotus_1-2-3
+# Reference: http://www.aboutvb.de/bas/formate/pdf/wk3.pdf
+# Note: newer Lotus versions >2 use longer BOF record
+# record type (BeginningOfFile=0000h) + length (001Ah)
+0      belong  0x00001a00      
+# reserved should be 0h but 8c0dh for TUTMAC.WK3, 5h for SAMPADNS.WK3, 1h for a_readme.wk3, 1eh for K&G86.WK3
+#>18   uleshort&0x73E0 0       
+# Lotus Multi Byte Character Set (LMBCS=1-31)
+>20    ubyte           >0      
+>>20   ubyte           <32     Lotus 1-2-3
+#!:mime        application/x-123
+!:mime application/vnd.lotus-1-2-3
+!:apple        ????L123
+# (version 5.26) labeled the entry as "Lotus 1-2-3 wk3 document data"
+>>>4   uleshort        0x1000  WorKsheet, version 3
+!:ext  wk3
+# (version 5.26) labeled the entry as "Lotus 1-2-3 wk4 document data"
+>>>4   uleshort        0x1002  WorKsheet, version 4
+# also worksheet template 4 (.wt4)
+!:ext  wk4/wt4
+# no example or documentation for wk5
+#>>4   uleshort        0x????  WorKsheet, version 4
+#!:ext wk5
+# only MacrotoScript.123 example
+>>>4   uleshort        0x1003  WorKsheet, version 97
+# also worksheet template Smartmaster (.12M)?
+!:ext  123
+# only Set_Y2K.123 example
+>>>4   uleshort        0x1005  WorKsheet, version 9.8 Millennium
+!:ext  123
+# no example for this version
+>>>4   uleshort        0x8001  FoRMatting data
+!:ext  frm
+# (version 5.26) labeled the entry as "Lotus 1-2-3 fm3 or fmb document data"
+# TrID labeles the entry as "Formatting Data for Lotus 1-2-3 worksheet"
+>>>4   uleshort        0x8007  ForMatting data, version 3
+!:ext  fm3
+>>>4   default         x       unknown
+# file revision sub code 0004h for worksheets
+>>>>6  uleshort        =0x0004 worksheet
+!:ext  wXX
+>>>>6  uleshort        !0x0004 formatting data
+!:ext  fXX
+# main revision number
+>>>>4  uleshort        x       \b, revision 0x%x
+>>>6   uleshort        =0x0004 \b, cell range 
+# active cellcoord range (start row, page,column ; end row, page, column)
+# start values normally 0~1st sheet A1
+>>>>8  ulelong         !0      
+>>>>>10        ubyte           >0      \b%d*
+>>>>>8 uleshort        x       \b%d,
+>>>>>11        ubyte           x       \b%d-
+# end page mostly 0
+>>>>14 ubyte           >0      \b%d*
+# end raw, column normally not 0
+>>>>12 uleshort        x       \b%d,
+>>>>15 ubyte           x       \b%d
+# Lotus Multi Byte Character Set (1~cp850,2~cp851,...,16~japan,...,31~??)
+>>>>20 ubyte           >1      \b, character set 0x%x
+# flags
+>>>>21 ubyte           x       \b, flags 0x%x
+>>>6   uleshort        !0x0004 
+# record type (FONTNAME=00AEh)
+>>>>30 search/29       \0\xAE  
+# variable length m (2) + entries (1) + ?? (1) + LCMBS string (n)
+>>>>>&4        string          >\0     \b, 1st font "%s"
 #
-0      belong  0x00000200      Lotus 1-2-3
-!:mime application/x-123
->4     belong  0x06040600      wk1 document data
->4     belong  0x06800200      fmt document data
+# Update: Joerg Jenderek
+# URL: http://fileformats.archiveteam.org/wiki/Lotus_1-2-3
+# Reference: http://www.schnarff.com/file-formats/lotus-1-2-3/WSFF2.TXT
+# Note: Used by both old Lotus 1-2-3 and Lotus Symphony (DOS) til version 2.x
+# record type (BeginningOfFile=0000h) + length (0002h)
+0      belong  0x00000200      
+# GRR: line above is too general as it catches also MS Windows CURsor
+# to display MS Windows cursor (strength=70) before Lotus 1-2-3 (strength=70-1)
+!:strength -1
+# skip Windows cursors with image height <256 and keep Lotus with low opcode 0001-0083h
+>7     ubyte           0       
+# skip Windows cursors with image width 256 and keep Lotus with positiv opcode
+>>6    ubyte           >0      Lotus
+# !:mime       application/x-123
+!:mime application/vnd.lotus-1-2-3
+!:apple        ????L123
+# revision number (0404h = 123 1A, 0405h = Lotus Symphony , 0406h = 123 2.x wk1 , 8006h = fmt , ...)
+# undocumented; (version 5.26) labeled the configurations as "Lotus 1-2-3"
+>>>4   uleshort        0x0007  1-2-3 CoNFiguration, version 2.x (PGRAPH.CNF)
+!:ext  cnf
+>>>4   uleshort        0x0C05  1-2-3 CoNFiguration, version 2.4J
+!:ext  cnf
+>>>4   uleshort        0x0801  1-2-3 CoNFiguration, version 1-2.1
+!:ext  cnf
+>>>4   uleshort        0x0802  Symphony CoNFiguration
+!:ext  cnf
+>>>4   uleshort        0x0804  1-2-3 CoNFiguration, version 2.2
+!:ext  cnf
+>>>4   uleshort        0x080A  1-2-3 CoNFiguration, version 2.3-2.4
+!:ext  cnf
+>>>4   uleshort        0x1402  1-2-3 CoNFiguration, version 3.x
+!:ext  cnf
+>>>4   uleshort        0x1450  1-2-3 CoNFiguration, version 4.x
+!:ext  cnf
+# (version 5.26) labeled the entry as "Lotus 123"
+# TrID labeles the entry as "Lotus 123 Worksheet (generic)"
+>>>4   uleshort        0x0404  1-2-3 WorKSheet, version 1
+# extension "wks" also for Microsoft Works document
+!:ext  wks
+# (version 5.26) labeled the entry as "Lotus 123"
+# TrID labeles the entry as "Lotus 123 Worksheet (generic)"
+>>>4   uleshort        0x0405  Symphony WoRksheet, version 1.0
+!:ext  wrk/wr1
+# (version 5.26) labeled the entry as "Lotus 1-2-3 wk1 document data"
+# TrID labeles the entry as "Lotus 123 Worksheet (V2)"
+>>>4   uleshort        0x0406  1-2-3/Symphony worksheet, version 2
+# Symphony (.wr1)
+!:ext  wk1/wr1
+# no example for this japan version
+>>>4   uleshort        0x0600  1-2-3 WorKsheet, version 1.xJ
+!:ext  wj1
+# no example or documentation for wk2
+#>>>4  uleshort        0x????  1-2-3 WorKsheet, version 2
+#!:ext wk2
+# undocumented japan version
+>>>4   uleshort        0x0602  1-2-3 worksheet, version 2.4J
+!:ext  wj3
+# (version 5.26) labeled the entry as "Lotus 1-2-3 fmt document data"
+>>>4   uleshort        0x8006  1-2-3 ForMaTting data, version 2.x
+# japan version 2.4J (fj3)
+!:ext  fmt/fj3
+# no example for this version
+>>>4   uleshort        0x8007  1-2-3 FoRMatting data, version 2.0
+!:ext  frm
+# (version 5.26) labeled the entry as "Lotus 1-2-3"
+>>>4   default         x       unknown worksheet or configuration
+!:ext  cnf
+>>>>4  uleshort        x       \b, revision 0x%x
+# 2nd record for most worksheets describes cells range
+>>>6           use     lotus-cells
+# 3nd record for most japan worksheets describes cells range
+>>>(8.s+10)    use     lotus-cells
+#      check and then display Lotus worksheet cells range
+0      name            lotus-cells
+# look for type (RANGE=0006h) + length (0008h) at record begin
+>0     ubelong 0x06000800      \b, cell range 
+# cell range (start column, row, end column, row) start values normally 0,0~A1 cell
+>>4    ulong           !0      
+>>>4   uleshort        x       \b%d,
+>>>6   uleshort        x       \b%d-
+# end of cell range
+>>8    uleshort        x       \b%d,
+>>10   uleshort        x       \b%d
+# EndOfLotus123
 0      string/b                WordPro\0       Lotus WordPro
 !:mime application/vnd.lotus-wordpro
 0      string/b                WordPro\r\373   Lotus WordPro
 0      lelong          0x00000005
 >12    lelong          0x00000320      Windows Recycle Bin INFO2 file (Win2k - WinXP)
 
-
-##### put in Either Magic/font or Magic/news
-# Acroread or something         files wrongly identified as G3  .pfm
-# these have the form \000 \001 any? \002 \000 \000
-# or \000 \001 any? \022 \000 \000
-0      belong&0xffff00ff       0x00010012      PFM data
->4     string                  \000\000
->6     string                  >\060           - %s
-
-0      belong&0xffff00ff       0x00010002      PFM data
->4     string                  \000\000
->6     string                  >\060           - %s
-#0     string  \000\001 pfm?
-#>3    string  \022\000\000Copyright\  yes
-#>3    string  \002\000\000Copyright\  yes
-#>3    string  >\0     oops, not a font file. Cancel that.
-#it clashes with ttf files so put it lower down.
-
 # From Doug Lee via a FreeBSD pr
 9      string          GERBILDOC       First Choice document
 9      string          GERBILDB        First Choice database
 # Type: Microsoft Document Imaging Format (.mdi)
 # URL: http://en.wikipedia.org/wiki/Microsoft_Document_Imaging_Format
 # From: Daniele Sempione <scrows@oziosi.org>
-0      short   0x5045                  Microsoft Document Imaging Format
+# Too weak (EP)
+#0     short   0x5045                  Microsoft Document Imaging Format
 
 # MS eBook format (.lit)
 0      string/b        ITOLITLS                Microsoft Reader eBook Data
index 3350106c25108c4703b176d8473847d0eca98779..c93b4ea4082102ea7cc9330fee2fef55945a90e2 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: pgp,v 1.10 2014/10/14 16:50:37 christos Exp $
+# $File: pgp,v 1.11 2014/11/11 21:32:38 christos Exp $
 # pgp:  file(1) magic for Pretty Good Privacy
 # see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
 #
 >0     byte    0x0a                    SHA512
 >0     byte    0x0b                    SHA224
 
+# display public key algorithms as human readable text
+0      name    key_algo
+>0     byte    0x01                    RSA (Encrypt or Sign)
+# keep old look of version 5.28 without parentheses
+>0     byte    0x02                    RSA Encrypt-Only
+>0     byte    0x03                    RSA (Sign-Only)
+>0     byte    16                      ElGamal (Encrypt-Only)
+>0     byte    17                      DSA
+>0     byte    18                      Elliptic Curve
+>0     byte    19                      ECDSA
+>0     byte    20                      ElGamal (Encrypt or Sign)
+>0     byte    21                      Diffie-Hellman
+>0     default x                       
+>>0    ubyte   <22                     unknown (pub %d)
+# this should never happen
+>>0    ubyte   >21                     invalid (%d)
+
 # pgp symmetric encrypted data
 
 0      byte    0x8c                    PGP symmetric key encrypted data -
 >1     use     pgpkey
 0      byte    0x97                    PGP     Secret Sub-key -
 >1     use     pgpkey
-0      byte    0x9d                    PGP     Secret Sub-key -
->1     use     pgpkey
+0      byte    0x9d                    
+# Update: Joerg Jenderek
+# secret subkey packet (tag 7) with same structure as secret key packet (tag 5)
+# skip Fetus.Sys16 CALIBUS.MAIN OrbFix.Sys16.Ex by looking for positive len
+>1     ubeshort        >0              
+#>1    ubeshort        x               \b, body length 0x%x
+# next packet type often 88h,89h~(tag 2)~Signature Packet
+#>>(1.S+3)     ubyte   x               \b, next packet type 0x%x
+# skip Dragon.SHR DEMO.INIT by looking for positive version
+>>3    ubyte           >0      
+# skip BUISSON.13 GUITAR1 by looking for low version number
+>>>3   ubyte           <5              PGP Secret Sub-key
+# sub-key are normally part of secret key. So it does not occur as standalone file
+#!:ext bin
+# version 2,3~old 4~new . Comment following line for version 5.28 look
+>>>>3  ubyte           x               (v%d)
+>>>>3  ubyte           x               -
+# old versions 2 or 3 but no real example found
+>>>>3  ubyte           <4              
+# 2 byte for key bits in version 5.28 look
+>>>>>11                ubeshort        x       %db
+>>>>>4         beldate         x       created on %s -
+# old versions use 2 additional bytes after time stamp
+#>>>>>8                ubeshort        x       0x%x
+# display key algorithm 1~RSA Encrypt|Sign - 21~Diffie-Hellman
+>>>>>10                use             key_algo
+>>>>>(11.S/8)  ubequad         x       
+# look after first key
+>>>>>>&5       use             keyend
+# new version
+>>>>3  ubyte           >3              
+>>>>>9         ubeshort        x       %db
+>>>>>4         beldate         x       created on %s -
+# display key algorithm
+>>>>>8         use             key_algo
+>>>>>(9.S/8)   ubequad         x       
+# look after first key for something like s2k
+>>>>>>&3       use             keyend
diff --git a/magic/Magdir/psl b/magic/Magdir/psl
new file mode 100644 (file)
index 0000000..e5a1e3a
--- /dev/null
@@ -0,0 +1,14 @@
+
+#------------------------------------------------------------------------------
+# $File: psl,v 1.1 2016/07/14 15:26:48 christos Exp $
+# psl:  file(1) magic for Public Suffix List representations
+# From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+# URL: https://publicsuffix.org
+# see also: http://thread.gmane.org/gmane.network.dns.libpsl.bugs/162/focus=166
+
+0      search/512      \n\n//\ ===BEGIN\ ICANN\ DOMAINS===\n\n Public Suffix List data
+
+0      string  .DAFSA@PSL_
+>15    string  \n      Public Suffix List data (optimized)
+>>11   byte    >0x2f
+>>>11  byte    <0x3a   (Version %c)
index b3e217eaac26267ef064626bc96ee12b72dccf46..1374947a3df03867d1b8c31450bcc6ed0f1296f9 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: python,v 1.27 2015/09/08 13:59:44 christos Exp $
+# $File: python,v 1.28 2015/09/16 22:19:54 christos Exp $
 # python:  file(1) magic for python
 #
 # Outlook puts """ too for urgent messages
@@ -9,7 +9,7 @@
 0      string/t        """     Python script text executable
 # MAGIC as specified in Python/import.c (1.5 to 2.7a0 and 3.1a0, assuming
 # that Py_UnicodeFlag is off for Python 2)
-# 20121  ( YEAR - 1995 ) + MONTH  + DAY (little endian followed by "\r\n"
+# two bytes of magic followed by "\r\n" in little endian order
 0      belong          0x994e0d0a      python 1.5/1.6 byte-compiled
 0      belong          0x87c60d0a      python 2.0 byte-compiled
 0      belong          0x2aeb0d0a      python 2.1 byte-compiled
@@ -24,6 +24,7 @@
 0      belong          0x6c0c0d0a      python 3.2 byte-compiled
 0      belong          0x9e0c0d0a      python 3.3 byte-compiled
 0      belong          0xee0c0d0a      python 3.4 byte-compiled
+0      belong          0x160d0d0a      python 3.5 byte-compiled
 
 0      search/1/w      #!\ /usr/bin/python     Python script text executable
 !:strength + 15
index d88152582d965268d9e2373768d8d6a1b9b63731..6468c4ab7ff223a264c2e3bd36f5cad8c5ef103f 100644 (file)
@@ -1,18 +1,22 @@
 
 #------------------------------------------------------------------------------
-# $File: ruby,v 1.4 2010/07/08 20:24:13 christos Exp $
+# $File: ruby,v 1.5 2010/07/21 16:47:17 christos Exp $
 # ruby:  file(1) magic for Ruby scripting language
 # URL:  http://www.ruby-lang.org/
 # From: Reuben Thomas <rrt@sc3d.org>
 
 # Ruby scripts
 0      search/1/w      #!\ /usr/bin/ruby       Ruby script text executable
+!:strength + 15
 !:mime text/x-ruby
 0      search/1/w      #!\ /usr/local/bin/ruby Ruby script text executable
+!:strength + 15
 !:mime text/x-ruby
 0      search/1        #!/usr/bin/env\ ruby    Ruby script text executable
+!:strength + 15
 !:mime text/x-ruby
 0      search/1        #!\ /usr/bin/env\ ruby  Ruby script text executable
+!:strength + 15
 !:mime text/x-ruby
 
 # What looks like ruby, but does not have a shebang
index 2c3375d8fcf5faade7314bb887340ad749470789..4b3207d6a96549da7dbd4fb4a6caf1715818fb07 100644 (file)
@@ -1,4 +1,4 @@
-#------------------------------------------------------------------------------ # $File: sgml,v 1.32 2015/07/11 15:08:53 christos Exp $
+#------------------------------------------------------------------------------ # $File: sgml,v 1.33 2015/11/29 22:14:49 christos Exp $
 # Type:        SVG Vectorial Graphics
 # From:        Noel Torres <tecnico@ejerciciosresueltos.com>
 0      string          \<?xml\ version="
@@ -7,6 +7,8 @@
 !:mime image/svg+xml
 >>19   search/4096     \<gnc-v2                GnuCash file
 !:mime application/x-gnucash
+0      string          \<svg                   SVG Scalable Vector Graphics image
+!:mime image/svg
 
 # Sitemap file
 0      string/t                \<?xml\ version="
index 34a34bf1a8073c0ed39f808f6de4c4ae8a1f4e0a..24b8f9b47420b104036b3b5b0fe7447385af7557 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: sql,v 1.17 2015/11/05 18:20:46 christos Exp $
+# $File: sql,v 1.19 2016/07/04 15:20:01 christos Exp $
 # sql:  file(1) magic for SQL files
 #
 # From: "Marty Leisner" <mleisner@eng.mc.xerox.com>
 #
 0      beshort                 0xfe01          MySQL table definition file
 >2     byte                    x               Version %d
+>3     byte                    0               \b, type UNKNOWN
+>3     byte                    1               \b, type DIAM_ISAM
+>3     byte                    2               \b, type HASH
+>3     byte                    3               \b, type MISAM
+>3     byte                    4               \b, type PISAM
+>3     byte                    5               \b, type RMS_ISAM
+>3     byte                    6               \b, type HEAP
+>3     byte                    7               \b, type ISAM
+>3     byte                    8               \b, type MRG_ISAM
+>3     byte                    9               \b, type MYISAM
+>3     byte                    10              \b, type MRG_MYISAM
+>3     byte                    11              \b, type BERKELEY_DB
+>3     byte                    12              \b, type INNODB
+>3     byte                    13              \b, type GEMINI
+>3     byte                    14              \b, type NDBCLUSTER
+>3     byte                    15              \b, type EXAMPLE_DB
+>3     byte                    16              \b, type CSV_DB
+>3     byte                    17              \b, type FEDERATED_DB
+>3     byte                    18              \b, type BLACKHOLE_DB
+>3     byte                    19              \b, type PARTITION_DB
+>3     byte                    20              \b, type BINLOG
+>3     byte                    21              \b, type SOLID
+>3     byte                    22              \b, type PBXT
+>3     byte                    23              \b, type TABLE_FUNCTION
+>3     byte                    24              \b, type MEMCACHE
+>3     byte                    25              \b, type FALCON
+>3     byte                    26              \b, type MARIA
+>3     byte                    27              \b, type PERFORMANCE_SCHEMA
+>3     byte                    127             \b, type DEFAULT
+>0x0033        ulong                   x               \b, MySQL version %d
+0      belong&0xffffff00       0xfefe0500      MySQL ISAM index file
+>3     byte                    x               Version %d
+0      belong&0xffffff00       0xfefe0600      MySQL ISAM compressed data file
+>3     byte                    x               Version %d
 0      belong&0xffffff00       0xfefe0700      MySQL MyISAM index file
 >3     byte                    x               Version %d
+>14    beshort                 x               \b, %d key parts
+>16    beshort                 x               \b, %d unique key parts
+>18    byte                    x               \b, %d keys
+>28    bequad                  x               \b, %lld records
+>36    bequad                  x               \b, %lld deleted records
 0      belong&0xffffff00       0xfefe0800      MySQL MyISAM compressed data file
 >3     byte                    x               Version %d
 0      belong&0xffffff00       0xfefe0900      MySQL Maria index file
 >3     byte                    x               Version %d
-0      belong&0xffffff00       0xfefe0A00      MySQL Maria compressed data file
+0      belong&0xffffff00       0xfefe0a00      MySQL Maria compressed data file
 >3     byte                    x               Version %d
-0      belong&0xffffff00       0xfefe0500      MySQL ISAM index file
->3     byte                    x               Version %d
-0      belong&0xffffff00       0xfefe0600      MySQL ISAM compressed data file
->3     byte                    x               Version %d
-0      string                  \376bin         MySQL replication log
-0      belong&0xffffff00       0xfefe0b00
->4     string                  MARIALOG        MySQL Maria transaction log file
->>3    byte                    x               Version %d
 0      belong&0xffffff00       0xfefe0c00
 >4     string                  MACF            MySQL Maria control file
 >>3    byte                    x               Version %d
+0      string                  \376bin MySQL replication log,
+>9     long                    x               server id %d
+>8     byte                    1
+>>13   long                    69              \b, MySQL V3.2.3
+>>>19  string                  x               \b, server version %s
+>>13   long                    75              \b, MySQL V4.0.2-V4.1
+>>>25  string                  x               \b, server version %s
+>8     byte                    15              MySQL V5+,
+>>25   string                  x               server version %s
+>4     string                  MARIALOG        MySQL Maria transaction log file
+>>3    byte                    x               Version %d
 
 #------------------------------------------------------------------------------
 # iRiver H Series database file 
 >126   string          SQLite\ format\ 3       
 #!:mime        application/x-panasonic-sqlite3
 >>&-15 indirect        x                       \b; contains 
+
+# H2 Database from http://www.h2database.com/
+0      string          --\ H2\ 0.5/B\ --\ \n   H2 Database file
index 880279d8cbc44f3ccc187a711e74a1815b42497a..c6cc6b0cf74263c2b13e6d1bc0a95ddc05147458 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $File: Makefile.am,v 1.115 2016/06/05 00:25:58 christos Exp $
+# $File: Makefile.am,v 1.119 2016/10/17 12:13:19 christos Exp $
 #
 MAGIC_FRAGMENT_BASE = Magdir
 MAGIC_DIR = $(top_srcdir)/magic
@@ -13,6 +13,7 @@ $(MAGIC_DIR)/Localstuff \
 $(MAGIC_FRAGMENT_DIR)/acorn \
 $(MAGIC_FRAGMENT_DIR)/adi \
 $(MAGIC_FRAGMENT_DIR)/adventure \
+$(MAGIC_FRAGMENT_DIR)/algol68 \
 $(MAGIC_FRAGMENT_DIR)/allegro \
 $(MAGIC_FRAGMENT_DIR)/alliant \
 $(MAGIC_FRAGMENT_DIR)/amanda \
@@ -22,7 +23,9 @@ $(MAGIC_FRAGMENT_DIR)/animation \
 $(MAGIC_FRAGMENT_DIR)/aout \
 $(MAGIC_FRAGMENT_DIR)/apl \
 $(MAGIC_FRAGMENT_DIR)/apple \
+$(MAGIC_FRAGMENT_DIR)/application \
 $(MAGIC_FRAGMENT_DIR)/applix \
+$(MAGIC_FRAGMENT_DIR)/apt \
 $(MAGIC_FRAGMENT_DIR)/archive \
 $(MAGIC_FRAGMENT_DIR)/assembler \
 $(MAGIC_FRAGMENT_DIR)/asterix \
@@ -207,6 +210,7 @@ $(MAGIC_FRAGMENT_DIR)/polyml \
 $(MAGIC_FRAGMENT_DIR)/printer \
 $(MAGIC_FRAGMENT_DIR)/project \
 $(MAGIC_FRAGMENT_DIR)/psdbms \
+$(MAGIC_FRAGMENT_DIR)/psl \
 $(MAGIC_FRAGMENT_DIR)/pulsar \
 $(MAGIC_FRAGMENT_DIR)/pwsafe \
 $(MAGIC_FRAGMENT_DIR)/pyramid \
index c48f7d5a3012e1c0a0ac982f9b62a72b7ae62320..b0f7a1765e8f71d33b7892171ad3612055c8c244 100644 (file)
@@ -134,7 +134,7 @@ class Magic(object):
         if isinstance(r, str):
             return r
         else:
-            return str(r).encode('utf-8')
+            return str(r'utf-8')
 
     def descriptor(self, fd):
         """
@@ -152,7 +152,7 @@ class Magic(object):
         if isinstance(r, str):
             return r
         else:
-            return str(r).encode('utf-8')
+            return str(r'utf-8')
 
     def error(self):
         """
@@ -163,7 +163,7 @@ class Magic(object):
         if isinstance(e, str):
             return e
         else:
-            return str(e).encode('utf-8')
+            return str(e'utf-8')
 
     def setflags(self, flags):
         """
index 38df328515ef23aa2b81e7be1d16e5fcdac8af49..7c8390e8a28597548026cf6716b6a5131e8498bb 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.248 2016/03/31 17:51:12 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.254 2016/10/24 15:21:07 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -408,11 +408,11 @@ add_mlist(struct mlist *mlp, struct magic_map *map, size_t idx)
 {
        struct mlist *ml;
 
-       mlp->map = idx == 0 ? map : NULL;
+       mlp->map = NULL;
        if ((ml = CAST(struct mlist *, malloc(sizeof(*ml)))) == NULL)
                return -1;
 
-       ml->map = NULL;
+       ml->map = idx == 0 ? map : NULL;
        ml->magic = map->magic[idx];
        ml->nmagic = map->nmagic[idx];
 
@@ -451,6 +451,8 @@ apprentice_1(struct magic_set *ms, const char *fn, int action)
 
 #ifndef COMPILE_ONLY
        map = apprentice_map(ms, fn);
+       if (map == (struct magic_map *)-1)
+               return -1;
        if (map == NULL) {
                if (ms->flags & MAGIC_CHECK)
                        file_magwarn(ms, "using regular magic file `%s'", fn);
@@ -462,7 +464,7 @@ apprentice_1(struct magic_set *ms, const char *fn, int action)
        for (i = 0; i < MAGIC_SETS; i++) {
                if (add_mlist(ms->mlist[i], map, i) == -1) {
                        file_oomem(ms, sizeof(*ml));
-                       goto fail;
+                       return -1;
                }
        }
 
@@ -476,12 +478,6 @@ apprentice_1(struct magic_set *ms, const char *fn, int action)
                }
        }
        return 0;
-fail:
-       for (i = 0; i < MAGIC_SETS; i++) {
-               mlist_free(ms->mlist[i]);
-               ms->mlist[i] = NULL;
-       }
-       return -1;
 #else
        return 0;
 #endif /* COMPILE_ONLY */
@@ -554,7 +550,7 @@ apprentice_unmap(struct magic_map *map)
        case MAP_TYPE_MALLOC:
                for (i = 0; i < MAGIC_SETS; i++) {
                        if ((char *)map->magic[i] >= (char *)map->p &&
-                           (char *)map->magic[i] < (char *)map->p + map->len)
+                           (char *)map->magic[i] <= (char *)map->p + map->len)
                                continue;
                        free(map->magic[i]);
                }
@@ -594,7 +590,7 @@ mlist_free(struct mlist *mlist)
        ml = mlist->next;
        for (ml = mlist->next; (next = ml->next) != NULL; ml = next) {
                if (ml->map)
-                       apprentice_unmap(ml->map);
+                       apprentice_unmap(CAST(struct magic_map *, ml->map));
                free(ml);
                if (ml == mlist)
                        break;
@@ -1879,10 +1875,13 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
        if (m->flag & INDIR) {
                m->in_type = FILE_LONG;
                m->in_offset = 0;
+               m->in_op = 0;
                /*
-                * read [.lbs][+-]nnnnn)
+                * read [.,lbs][+-]nnnnn)
                 */
-               if (*l == '.') {
+               if (*l == '.' || *l == ',') {
+                       if (*l == ',')
+                               m->in_op |= FILE_OPSIGNED;
                        l++;
                        switch (*l) {
                        case 'l':
@@ -1934,7 +1933,6 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
                        l++;
                }
 
-               m->in_op = 0;
                if (*l == '~') {
                        m->in_op |= FILE_OPINVERSE;
                        l++;
@@ -2930,6 +2928,7 @@ apprentice_map(struct magic_set *ms, const char *fn)
        struct stat st;
        char *dbname = NULL;
        struct magic_map *map;
+       struct magic_map *rv = NULL;
 
        fd = -1;
        if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
@@ -2978,8 +2977,10 @@ apprentice_map(struct magic_set *ms, const char *fn)
        (void)close(fd);
        fd = -1;
 
-       if (check_buffer(ms, map, dbname) != 0)
+       if (check_buffer(ms, map, dbname) != 0) {
+               rv = (struct magic_map *)-1;
                goto error;
+       }
 #ifdef QUICK
        if (mprotect(map->p, (size_t)st.st_size, PROT_READ) == -1) {
                file_error(ms, errno, "cannot mprotect `%s'", dbname);
@@ -2995,7 +2996,7 @@ error:
                (void)close(fd);
        apprentice_unmap(map);
        free(dbname);
-       return NULL;
+       return rv;
 }
 
 private int
@@ -3151,7 +3152,7 @@ mkdbname(struct magic_set *ms, const char *fn, int strip)
                return NULL;
 
        /* Compatibility with old code that looked in .mime */
-       if (strstr(p, ".mime") != NULL)
+       if (strstr(fn, ".mime") != NULL)
                ms->flags &= MAGIC_MIME_TYPE;
        return buf;
 }
index 586f16e5b87b0fb13d240d04ec8c9c1665625368..0321f40bdbe59ff74b1c974b4db4c6254aa2dee3 100644 (file)
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: ascmagic.c,v 1.94 2016/03/31 17:51:12 christos Exp $")
+FILE_RCSID("@(#)$File: ascmagic.c,v 1.96 2016/06/16 11:37:55 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -144,8 +144,10 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
                    (size_t)(utf8_end - utf8_buf), NULL, NULL,
                    TEXTTEST, text)) == 0)
                        rv = -1;
-               if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)))
-                       return rv == -1 ? 0 : 1;
+               if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION))) {
+                       rv = rv == -1 ? 0 : 1;
+                       goto done;
+               }
        }
        if ((ms->flags & (MAGIC_APPLE|MAGIC_EXTENSION)))
                return 0;
index 1d20453b8ca4358ed22b893edec173448029ddf4..94f216333c9e8b457faf767968efd62a2a4fb664 100644 (file)
--- a/src/cdf.c
+++ b/src/cdf.c
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.81 2016/06/01 22:21:14 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.84 2016/10/17 15:25:34 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -266,7 +266,7 @@ cdf_unpack_dir(cdf_directory_t *d, char *buf)
        CDF_UNPACK(d->d_unused0);
 }
 
-static int
+int
 cdf_zero_stream(cdf_stream_t *scn)
 {
        scn->sst_len = 0;
@@ -731,22 +731,25 @@ cdf_read_short_stream(const cdf_info_t *info, const cdf_header_t *h,
                        break;
 
        /* If the it is not there, just fake it; some docs don't have it */
-       if (i == dir->dir_len)
+       if (i == dir->dir_len) {
+               DPRINTF(("Cannot find root storage dir\n"));
                goto out;
+       }
        d = &dir->dir_tab[i];
        *root = d;
 
        /* If the it is not there, just fake it; some docs don't have it */
-       if (d->d_stream_first_sector < 0)
+       if (d->d_stream_first_sector < 0) {
+               DPRINTF(("No first secror in dir\n"));
                goto out;
+       }
 
        return cdf_read_long_sector_chain(info, h, sat,
            d->d_stream_first_sector, d->d_size, scn);
 out:
        scn->sst_tab = NULL;
        (void)cdf_zero_stream(scn);
-       errno = EFTYPE;
-       return -1;
+       return 0;
 }
 
 static int
@@ -758,6 +761,15 @@ cdf_namecmp(const char *d, const uint16_t *s, size_t l)
        return 0;
 }
 
+int
+cdf_read_doc_summary_info(const cdf_info_t *info, const cdf_header_t *h,
+    const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst,
+    const cdf_dir_t *dir, cdf_stream_t *scn)
+{
+       return cdf_read_user_stream(info, h, sat, ssat, sst, dir,
+           "\05DocumentSummaryInformation", scn);
+}
+
 int
 cdf_read_summary_info(const cdf_info_t *info, const cdf_header_t *h,
     const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst,
@@ -1098,7 +1110,7 @@ cdf_unpack_catalog(const cdf_header_t *h, const cdf_stream_t *sst,
                        cep->ce_namlen = rlen;
 
                np = CAST(const uint16_t *, CAST(const void *, (b + 16)));
-               if (CAST(const char *, np + cep->ce_namlen) > eb) {
+               if (RCAST(const char *, np + cep->ce_namlen) > eb) {
                        cep->ce_namlen = 0;
                        break;
                }
@@ -1275,7 +1287,7 @@ cdf_dump(const void *v, size_t len)
 }
 
 void
-cdf_dump_stream(const cdf_header_t *h, const cdf_stream_t *sst)
+cdf_dump_stream(const cdf_stream_t *sst)
 {
        size_t ss = sst->sst_ss;
        cdf_dump(sst->sst_tab, ss * sst->sst_len);
@@ -1331,7 +1343,7 @@ cdf_dump_dir(const cdf_info_t *info, const cdf_header_t *h,
                                    name, d->d_stream_first_sector, d->d_size);
                                break;
                        }
-                       cdf_dump_stream(h, &scn);
+                       cdf_dump_stream(&scn);
                        free(scn.sst_tab);
                        break;
                default:
@@ -1507,7 +1519,7 @@ main(int argc, char *argv[])
                    == -1)
                        err(1, "Cannot read short stream");
 #ifdef CDF_DEBUG
-               cdf_dump_stream(&h, &sst);
+               cdf_dump_stream(&sst);
 #endif
 
 #ifdef CDF_DEBUG
index 853a71996b636c3ea36e1e198b76766523492605..0b345ab49615deab8eb0a0b5861cd3a682742f9c 100644 (file)
--- a/src/cdf.h
+++ b/src/cdf.h
@@ -316,6 +316,10 @@ int cdf_read_user_stream(const cdf_info_t *, const cdf_header_t *,
     const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
     const cdf_dir_t *, const char *, cdf_stream_t *);
 int cdf_find_stream(const cdf_dir_t *, const char *, int);
+int cdf_zero_stream(cdf_stream_t *);
+int cdf_read_doc_summary_info(const cdf_info_t *, const cdf_header_t *,
+    const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
+    const cdf_dir_t *, cdf_stream_t *);
 int cdf_read_summary_info(const cdf_info_t *, const cdf_header_t *,
     const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
     const cdf_dir_t *, cdf_stream_t *);
@@ -336,7 +340,7 @@ char *cdf_u16tos8(char *, size_t, const uint16_t *);
 void cdf_dump_header(const cdf_header_t *);
 void cdf_dump_sat(const char *, const cdf_sat_t *, size_t);
 void cdf_dump(const void *, size_t);
-void cdf_dump_stream(const cdf_header_t *, const cdf_stream_t *);
+void cdf_dump_stream(const cdf_stream_t *);
 void cdf_dump_dir(const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *,
     const cdf_sat_t *, const cdf_stream_t *, const cdf_dir_t *);
 void cdf_dump_property_info(const cdf_property_info_t *, size_t);
index e11ec8af468511d9292cef04dc2bef6813bded9e..32920c3d9d868a175da2fefc50d46b046836a56f 100644 (file)
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.96 2016/04/20 00:00:26 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.99 2016/09/16 12:12:05 christos Exp $")
 #endif
 
 #include "magic.h"
@@ -132,6 +132,9 @@ static const char *lrzip_args[] = {
 static const char *lz4_args[] = {
        "lz4", "-cd", NULL
 };
+static const char *zstd_args[] = {
+       "zstd", "-cd", NULL
+};
 
 private const struct {
        const void *magic;
@@ -154,8 +157,9 @@ private const struct {
        { "\3757zXZ\0", 6, xz_args },           /* XZ Utils */
        { "LRZI",       4, lrzip_args },        /* LRZIP */
        { "\004\"M\030",4, lz4_args },          /* LZ4 */
+       { "\x28\xB5\x2F\xFD", 4, zstd_args },   /* zstd */
 #ifdef ZLIBSUPPORT
-       { zlibcmp,      0, zlib_args },         /* zlib */
+       { RCAST(const void *, zlibcmp), 0, zlib_args },         /* zlib */
 #endif
 };
 
@@ -204,7 +208,7 @@ file_zmagic(struct magic_set *ms, int fd, const char *name,
                        continue;
 #ifdef ZLIBSUPPORT
                if (compr[i].maglen == 0)
-                       zm = (CAST(int (*)(const unsigned char *),
+                       zm = (RCAST(int (*)(const unsigned char *),
                            CCAST(void *, compr[i].magic)))(buf);
                else
 #endif
@@ -362,7 +366,7 @@ nocheck:
                        return rn - n;
                default:
                        n -= rv;
-                       buf = ((char *)buf) + rv;
+                       buf = CAST(char *, CCAST(void *, buf)) + rv;
                        break;
                }
        while (n > 0);
@@ -517,7 +521,7 @@ uncompresszlib(const unsigned char *old, unsigned char **newch,
 
        return OKDATA;
 err:
-       strlcpy((char *)*newch, z.msg, bytes_max);
+       strlcpy((char *)*newch, z.msg ? z.msg : zError(rc), bytes_max);
        *n = strlen((char *)*newch);
        return ERRDATA;
 }
index fcdeb6c798145a98febc3a202e334d901daea256..ee7a7aec6de432cac98d77db97d7d6c95f9d0ef3 100644 (file)
--- a/src/der.c
+++ b/src/der.c
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: der.c,v 1.6 2016/04/21 14:26:03 christos Exp $")
+FILE_RCSID("@(#)$File: der.c,v 1.9 2016/10/24 15:19:08 christos Exp $")
 #endif
 #endif
 
 #include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
 
 #include <stdio.h>
 #include <fcntl.h>
@@ -53,6 +51,8 @@ FILE_RCSID("@(#)$File: der.c,v 1.6 2016/04/21 14:26:03 christos Exp $")
 #include "magic.h"
 #include "der.h"
 #else
+#include <sys/mman.h>
+#include <sys/stat.h>
 #include <err.h>
 #endif
 
@@ -181,6 +181,8 @@ getlength(const uint8_t *c, size_t *p, size_t l)
 
        for (i = 0; i < digits; i++)
                len = (len << 8) | c[(*p)++];
+       if (*p + len >= l)
+               return DER_BAD;
         return len;
 }
 
@@ -198,7 +200,7 @@ der_tag(char *buf, size_t len, uint32_t tag)
 static int
 der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len)
 {
-       const uint8_t *d = q;
+       const uint8_t *d = CAST(const uint8_t *, q);
        switch (tag) {
        case DER_TAG_PRINTABLE_STRING:
        case DER_TAG_UTF8_STRING:
@@ -220,7 +222,7 @@ der_data(char *buf, size_t blen, uint32_t tag, const void *q, uint32_t len)
 int32_t
 der_offs(struct magic_set *ms, struct magic *m, size_t nbytes)
 {
-       const uint8_t *b = CAST(const void *, ms->search.s);
+       const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
        size_t offs = 0, len = ms->search.s_len ? ms->search.s_len : nbytes;
 
        if (gettag(b, &offs, len) == DER_BAD)
@@ -251,7 +253,7 @@ der_offs(struct magic_set *ms, struct magic *m, size_t nbytes)
 int
 der_cmp(struct magic_set *ms, struct magic *m)
 {
-       const uint8_t *b = CAST(const void *, ms->search.s);
+       const uint8_t *b = RCAST(const uint8_t *, ms->search.s);
        const char *s = m->value.s;
        size_t offs = 0, len = ms->search.s_len;
        uint32_t tag, tlen;
index 7a5a935db8dee92f382be669b042b4f9576ecc91..c8f992a15d0fce6b68efd8b749a5f8124a3e9cf2 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: file.c,v 1.170 2016/03/31 17:51:12 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.171 2016/05/17 15:52:45 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -431,6 +431,8 @@ private struct magic_set *
 load(const char *magicfile, int flags)
 {
        struct magic_set *magic = magic_open(flags);
+       const char *e;
+
        if (magic == NULL) {
                (void)fprintf(stderr, "%s: %s\n", progname, strerror(errno));
                return NULL;
@@ -441,6 +443,8 @@ load(const char *magicfile, int flags)
                magic_close(magic);
                return NULL;
        }
+       if ((e = magic_error(magic)) != NULL)
+               (void)fprintf(stderr, "%s: Warning: %s\n", progname, e);
        return magic;
 }
 
index c54d39e9a794c2a0e32ca4d4a3a64675e67bfefe..1aa9047971a36ef33e9992e53bf55baae6dc66ea 100644 (file)
@@ -27,7 +27,7 @@
  */
 /*
  * file.h - definitions for file(1) program
- * @(#)$File: file.h,v 1.177 2016/03/21 15:56:53 christos Exp $
+ * @(#)$File: file.h,v 1.179 2016/07/05 19:20:19 christos Exp $
  */
 
 #ifndef __file_h__
                                   or directory */
 #define MAXDESC        64              /* max len of text description/MIME type */
 #define MAXMIME        80              /* max len of text MIME type */
-#define MAXstring 64           /* max len of "string" types */
+#define MAXstring 96           /* max len of "string" types */
 
 #define MAGICNO                0xF11E041C
-#define VERSIONNO      13
-#define FILE_MAGICSIZE 312
+#define VERSIONNO      14
+#define FILE_MAGICSIZE 344
 
 #define        FILE_LOAD       0
 #define FILE_CHECK     1
@@ -275,7 +275,7 @@ struct magic {
 #define                                FILE_OPS_MASK   0x07 /* mask for above ops */
 #define                                FILE_UNUSED_1   0x08
 #define                                FILE_UNUSED_2   0x10
-#define                                FILE_UNUSED_3   0x20
+#define                                FILE_OPSIGNED   0x20
 #define                                FILE_OPINVERSE  0x40
 #define                                FILE_OPINDIRECT 0x80
 
index 8225fc448d04b1f0393df2977c7c216f70db6071..3d4578ab029ca4be007e3fbe22a871a5f67adba6 100644 (file)
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.88 2016/02/10 15:57:40 christos Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.89 2016/03/21 15:56:53 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -250,7 +250,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
        }
 
        /* try soft magic tests */
-       if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
+       if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0) {
                m = file_softmagic(ms, ubuf, nb, NULL, NULL, BINTEST,
                    looks_text);
                if ((ms->flags & MAGIC_DEBUG) != 0)
@@ -277,6 +277,7 @@ file_buffer(struct magic_set *ms, int fd, const char *inname __attribute__ ((__u
                        if (checkdone(ms, &rv))
                                goto done;
                }
+       }
 
        /* try text properties */
        if ((ms->flags & MAGIC_NO_CHECK_TEXT) == 0) {
index 4474793a1ecc3b440a2f24fb7bfb945d7d7230be..a9b7e32af857b24a5714f477952a07cb1b8b01d8 100644 (file)
@@ -33,7 +33,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: magic.c,v 1.98 2016/04/19 20:51:54 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.99 2016/05/03 16:09:38 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -492,7 +492,7 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
                        if (r < PIPE_BUF) break;
                }
 
-               if (nbytes == 0) {
+               if (nbytes == 0 && inname) {
                        /* We can not read it, but we were able to stat it. */
                        if (unreadable_info(ms, sb.st_mode, inname) == -1)
                                goto done;
index d125da5b22c23edd472f78848c3d971b264b4fa0..8e7f55defd46ca4789782a3d7010e5232a6cec83 100644 (file)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2008 Christos Zoulas
+ * Copyright (c) 2008, 2016 Christos Zoulas
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: readcdf.c,v 1.56 2016/03/03 22:20:03 christos Exp $")
+FILE_RCSID("@(#)$File: readcdf.c,v 1.62 2016/10/18 16:10:07 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -373,13 +373,61 @@ cdf_file_catalog_info(struct magic_set *ms, const cdf_info_t *info,
            dir, "Catalog", scn)) == -1)
                return i;
 #ifdef CDF_DEBUG
-       cdf_dump_catalog(&h, scn);
+       cdf_dump_catalog(h, scn);
 #endif
        if ((i = cdf_file_catalog(ms, h, scn)) == -1)
                return -1;
        return i;
 }
 
+private int
+cdf_check_summary_info(struct magic_set *ms, const cdf_info_t *info,
+    const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat,
+    const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn,
+    const cdf_directory_t *root_storage, const char **expn)
+{
+       int i;
+       const char *str = NULL;
+       cdf_directory_t *d;
+       char name[__arraycount(d->d_name)];
+       size_t j, k;
+
+#ifdef CDF_DEBUG
+        cdf_dump_summary_info(h, scn);
+#endif
+        if ((i = cdf_file_summary_info(ms, h, scn, root_storage)) < 0) {
+            *expn = "Can't expand summary_info";
+           return i;
+       }
+       if (i == 1)
+               return i;
+       for (j = 0; str == NULL && j < dir->dir_len; j++) {
+               d = &dir->dir_tab[j];
+               for (k = 0; k < sizeof(name); k++)
+                       name[k] = (char)cdf_tole2(d->d_name[k]);
+               str = cdf_app_to_mime(name,
+                                     NOTMIME(ms) ? name2desc : name2mime);
+       }
+       if (NOTMIME(ms)) {
+               if (str != NULL) {
+                       if (file_printf(ms, "%s", str) == -1)
+                               return -1;
+                       i = 1;
+               }
+       } else {
+               if (str == NULL)
+                       str = "vnd.ms-office";
+               if (file_printf(ms, "application/%s", str) == -1)
+                       return -1;
+               i = 1;
+       }
+       if (i <= 0) {
+               i = cdf_file_catalog_info(ms, info, h, sat, ssat, sst,
+                                         dir, scn);
+       }
+       return i;
+}
+
 private struct sinfo {
        const char *name;
        const char *mime;
@@ -388,10 +436,13 @@ private struct sinfo {
 } sectioninfo[] = {
        { "Encrypted", "encrypted", 
                {
-                       "EncryptedPackage", NULL, NULL, NULL, NULL,
+                       "EncryptedPackage", "EncryptedSummary",
+                       NULL, NULL, NULL,
                },
                {
-                       CDF_DIR_TYPE_USER_STREAM, 0, 0, 0, 0,
+                       CDF_DIR_TYPE_USER_STREAM,
+                       CDF_DIR_TYPE_USER_STREAM,
+                       0, 0, 0,
 
                },
        },
@@ -412,6 +463,46 @@ private struct sinfo {
                        0, 0, 0, 0
                },
        },
+       { "Microsoft Excel", "vnd.ms-excel",
+               {
+                       "Book", "Workbook", NULL, NULL, NULL,
+               },
+               {
+                       CDF_DIR_TYPE_USER_STREAM,
+                       CDF_DIR_TYPE_USER_STREAM,
+                       0, 0, 0,
+               },
+       },
+       { "Microsoft Word", "msword",
+               {
+                       "WordDocument", NULL, NULL, NULL, NULL,
+               },
+               {
+                       CDF_DIR_TYPE_USER_STREAM,
+                       0, 0, 0, 0,
+               },
+       },
+       { "Microsoft PowerPoint", "vnd.ms-powerpoint",
+               {
+                       "PowerPoint", NULL, NULL, NULL, NULL,
+               },
+               {
+                       CDF_DIR_TYPE_USER_STREAM,
+                       0, 0, 0, 0,
+               },
+       },
+       { "Microsoft Outlook Message", "vnd.ms-outlook",
+               {
+                       "__properties_version1.0",
+                       "__recip_version1.0_#00000000",
+                       NULL, NULL, NULL,
+               },
+               {
+                       CDF_DIR_TYPE_USER_STREAM,
+                       CDF_DIR_TYPE_USER_STORAGE,
+                       0, 0, 0,
+               },
+       },
 };
 
 private int
@@ -423,22 +514,19 @@ cdf_file_dir_info(struct magic_set *ms, const cdf_dir_t *dir)
                const struct sinfo *si = &sectioninfo[sd];
                for (j = 0; si->sections[j]; j++) {
                        if (cdf_find_stream(dir, si->sections[j], si->types[j])
-                           <= 0) {
+                           > 0)
+                               break;
 #ifdef CDF_DEBUG
-                               fprintf(stderr, "Can't read %s\n",
-                                   si->sections[j]);
+                       fprintf(stderr, "Can't read %s\n", si->sections[j]);
 #endif
-                               break;
-                       }
                }
-               if (si->sections[j] != NULL)
+               if (si->sections[j] == NULL)
                        continue;
                if (NOTMIME(ms)) {
                        if (file_printf(ms, "CDFV2 %s", si->name) == -1)
                                return -1;
                } else {
-                       if (file_printf(ms, "application/CDFV2-%s",
-                           si->mime) == -1)
+                       if (file_printf(ms, "application/%s", si->mime) == -1)
                                return -1;
                }
                return 1;
@@ -459,6 +547,7 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
         const char *expn = "";
         const cdf_directory_t *root_storage;
 
+        scn.sst_tab = NULL;
         info.i_fd = fd;
         info.i_buf = buf;
         info.i_len = nbytes;
@@ -528,10 +617,7 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
                    i = 1;
                    goto out5;
                } else {
-                   free(scn.sst_tab);
-                   scn.sst_tab = NULL;
-                   scn.sst_len = 0;
-                   scn.sst_dirlen = 0;
+                   cdf_zero_stream(&scn);
                }
        }
 
@@ -539,56 +625,31 @@ file_trycdf(struct magic_set *ms, int fd, const unsigned char *buf,
             &scn)) == -1) {
                 if (errno != ESRCH) {
                         expn = "Cannot read summary info";
-                       goto out4;
                }
-               i = cdf_file_catalog_info(ms, &info, &h, &sat, &ssat, &sst,
-                   &dir, &scn);
-               if (i > 0)
-                       goto out4;
-               i = cdf_file_dir_info(ms, &dir);
-               if (i < 0)
-                        expn = "Cannot read section info";
-               goto out4;
+       } else {
+               i = cdf_check_summary_info(ms, &info, &h,
+                   &sat, &ssat, &sst, &dir, &scn, root_storage, &expn);
+               cdf_zero_stream(&scn);
        }
-
-
-#ifdef CDF_DEBUG
-        cdf_dump_summary_info(&h, &scn);
-#endif
-        if ((i = cdf_file_summary_info(ms, &h, &scn, root_storage)) < 0)
-            expn = "Can't expand summary_info";
-
-       if (i == 0) {
-               const char *str = NULL;
-               cdf_directory_t *d;
-               char name[__arraycount(d->d_name)];
-               size_t j, k;
-
-               for (j = 0; str == NULL && j < dir.dir_len; j++) {
-                       d = &dir.dir_tab[j];
-                       for (k = 0; k < sizeof(name); k++)
-                               name[k] = (char)cdf_tole2(d->d_name[k]);
-                       str = cdf_app_to_mime(name,
-                           NOTMIME(ms) ? name2desc : name2mime);
-               }
-               if (NOTMIME(ms)) {
-                       if (str != NULL) {
-                               if (file_printf(ms, "%s", str) == -1)
-                                       return -1;
-                               i = 1;
+       if (i <= 0) {
+               if ((i = cdf_read_doc_summary_info(&info, &h, &sat, &ssat,
+                   &sst, &dir, &scn)) == -1) {
+                       if (errno != ESRCH) {
+                               expn = "Cannot read summary info";
                        }
                } else {
-                       if (str == NULL)
-                               str = "vnd.ms-office";
-                       if (file_printf(ms, "application/%s", str) == -1)
-                               return -1;
-                       i = 1;
+                       i = cdf_check_summary_info(ms, &info, &h, &sat, &ssat,
+                           &sst, &dir, &scn, root_storage, &expn);
                }
        }
+       if (i <= 0) {
+               i = cdf_file_dir_info(ms, &dir);
+               if (i < 0)
+                       expn = "Cannot read section info";
+       }
 out5:
-        free(scn.sst_tab);
-out4:
-        free(sst.sst_tab);
+       cdf_zero_stream(&scn);
+       cdf_zero_stream(&sst);
 out3:
         free(dir.dir_tab);
 out2:
@@ -605,7 +666,7 @@ out0:
                    if (file_printf(ms, ", %s", expn) == -1)
                        return -1;
            } else {
-               if (file_printf(ms, "application/CDFV2-unknown") == -1)
+               if (file_printf(ms, "application/CDFV2") == -1)
                    return -1;
            }
            i = 1;
index 0e67b8ff273ced6e9bf75f58c021a1f26c729acf..c76a0accf8525280c7d7cf2006c0b5699a5cad23 100644 (file)
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.126 2015/11/16 16:03:45 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.127 2015/11/18 12:29:29 christos Exp $")
 #endif
 
 #ifdef BUILTIN_ELF
@@ -509,12 +509,26 @@ do_bid_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
     size_t noff, size_t doff, int *flags)
 {
        if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
-           type == NT_GNU_BUILD_ID && (descsz == 16 || descsz == 20)) {
+           type == NT_GNU_BUILD_ID && (descsz >= 4 || descsz <= 20)) {
                uint8_t desc[20];
+               const char *btype;
                uint32_t i;
                *flags |= FLAGS_DID_BUILD_ID;
-               if (file_printf(ms, ", BuildID[%s]=", descsz == 16 ? "md5/uuid" :
-                   "sha1") == -1)
+               switch (descsz) {
+               case 8:
+                   btype = "xxHash";
+                   break;
+               case 16:
+                   btype = "md5/uuid";
+                   break;
+               case 20:
+                   btype = "sha1";
+                   break;
+               default:
+                   btype = "unknown";
+                   break;
+               }
+               if (file_printf(ms, ", BuildID[%s]=", btype) == -1)
                        return 1;
                (void)memcpy(desc, &nbuf[doff], descsz);
                for (i = 0; i < descsz; i++)
index 4d52fe6187e2273077c2083c5764619f8a623547..16e38f991bd1de2949e8dfa77be5aeb925642f29 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.233 2016/06/01 22:04:10 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.237 2016/10/10 20:44:15 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -57,13 +57,13 @@ private int mcopy(struct magic_set *, union VALUETYPE *, int, int,
     const unsigned char *, uint32_t, size_t, struct magic *);
 private int mconvert(struct magic_set *, struct magic *, int);
 private int print_sep(struct magic_set *, int);
-private int handle_annotation(struct magic_set *, struct magic *);
+private int handle_annotation(struct magic_set *, struct magic *, int);
 private int cvt_8(union VALUETYPE *, const struct magic *);
 private int cvt_16(union VALUETYPE *, const struct magic *);
 private int cvt_32(union VALUETYPE *, const struct magic *);
 private int cvt_64(union VALUETYPE *, const struct magic *);
 
-#define OFFSET_OOB(n, o, i)    ((n) < (o) || (i) > ((n) - (o)))
+#define OFFSET_OOB(n, o, i)    ((n) < (uint32_t)(o) || (i) > ((n) - (o)))
 #define BE64(p) (((uint64_t)(p)->hq[0]<<56)|((uint64_t)(p)->hq[1]<<48)| \
     ((uint64_t)(p)->hq[2]<<40)|((uint64_t)(p)->hq[3]<<32)| \
     ((uint64_t)(p)->hq[4]<<24)|((uint64_t)(p)->hq[5]<<16)| \
@@ -80,6 +80,7 @@ private int cvt_64(union VALUETYPE *, const struct magic *);
      ((uint32_t)(p)->hl[3]<<8)|((uint32_t)(p)->hl[2]))
 #define BE16(p) (((uint16_t)(p)->hs[0]<<8)|((uint16_t)(p)->hs[1]))
 #define LE16(p) (((uint16_t)(p)->hs[1]<<8)|((uint16_t)(p)->hs[0]))
+#define SEXT(s,v,p) ((s)?(intmax_t)(int##v##_t)(p):(intmax_t)(uint##v##_t)(p))
 
 /*
  * softmagic - lookup one file in parsed, in-memory copy of database
@@ -230,7 +231,7 @@ flush:
                        goto flush;
                }
 
-               if ((e = handle_annotation(ms, m)) != 0) {
+               if ((e = handle_annotation(ms, m, firstline)) != 0) {
                        *need_separator = 1;
                        *printed_something = 1;
                        *returnval = 1;
@@ -328,7 +329,7 @@ flush:
                                } else
                                        ms->c.li[cont_level].got_match = 1;
 
-                               if ((e = handle_annotation(ms, m)) != 0) {
+                               if ((e = handle_annotation(ms, m, firstline)) != 0) {
                                        *need_separator = 1;
                                        *printed_something = 1;
                                        *returnval = 1;
@@ -1226,7 +1227,7 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
                                 memchr(c, '\r', CAST(size_t, (end - c))))));
                             lines--, b++) {
                                last = b;
-                               if (b[0] == '\r' && b[1] == '\n')
+                               if (b < end - 1 && b[0] == '\r' && b[1] == '\n')
                                        b++;
                        }
                        if (lines)
@@ -1294,6 +1295,45 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
        return 0;
 }
 
+private uint32_t
+do_ops(struct magic *m, intmax_t lhs, intmax_t off)
+{
+       intmax_t offset;
+       if (off) {
+               switch (m->in_op & FILE_OPS_MASK) {
+               case FILE_OPAND:
+                       offset = lhs & off;
+                       break;
+               case FILE_OPOR:
+                       offset = lhs | off;
+                       break;
+               case FILE_OPXOR:
+                       offset = lhs ^ off;
+                       break;
+               case FILE_OPADD:
+                       offset = lhs + off;
+                       break;
+               case FILE_OPMINUS:
+                       offset = lhs - off;
+                       break;
+               case FILE_OPMULTIPLY:
+                       offset = lhs * off;
+                       break;
+               case FILE_OPDIVIDE:
+                       offset = lhs / off;
+                       break;
+               case FILE_OPMODULO:
+                       offset = lhs % off;
+                       break;
+               }
+       } else
+               offset = lhs;
+       if (m->in_op & FILE_OPINVERSE)
+               offset = ~offset;
+
+       return (uint32_t)offset;
+}
+
 private int
 mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
     size_t nbytes, size_t o, unsigned int cont_level, int mode, int text,
@@ -1301,7 +1341,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
     int *printed_something, int *need_separator, int *returnval)
 {
        uint32_t offset = ms->offset;
-       uint32_t lhs;
+       intmax_t lhs;
        file_pushbuf_t *pb;
        int rv, oneed_separator, in_type;
        char *rbuf;
@@ -1337,7 +1377,8 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
        }
 
        if (m->flag & INDIR) {
-               int off = m->in_offset;
+               intmax_t off = m->in_offset;
+               const int sgn = m->in_op & FILE_OPSIGNED;
                if (m->in_op & FILE_OPINDIRECT) {
                        const union VALUETYPE *q = CAST(const union VALUETYPE *,
                            ((const void *)(s + offset + off)));
@@ -1345,178 +1386,55 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
                                return 0;
                        switch (cvt_flip(m->in_type, flip)) {
                        case FILE_BYTE:
-                               off = q->b;
+                               off = SEXT(sgn,8,q->b);
                                break;
                        case FILE_SHORT:
-                               off = q->h;
+                               off = SEXT(sgn,16,q->h);
                                break;
                        case FILE_BESHORT:
-                               off = (short)BE16(q);
+                               off = SEXT(sgn,16,BE16(q));
                                break;
                        case FILE_LESHORT:
-                               off = (short)LE16(q);
+                               off = SEXT(sgn,16,LE16(q));
                                break;
                        case FILE_LONG:
-                               off = q->l;
+                               off = SEXT(sgn,32,q->l);
                                break;
                        case FILE_BELONG:
                        case FILE_BEID3:
-                               off = (int32_t)BE32(q);
+                               off = SEXT(sgn,32,BE32(q));
                                break;
                        case FILE_LEID3:
                        case FILE_LELONG:
-                               off = (int32_t)LE32(q);
+                               off = SEXT(sgn,32,LE32(q));
                                break;
                        case FILE_MELONG:
-                               off = (int32_t)ME32(q);
+                               off = SEXT(sgn,32,ME32(q));
                                break;
                        }
                        if ((ms->flags & MAGIC_DEBUG) != 0)
-                               fprintf(stderr, "indirect offs=%u\n", off);
+                               fprintf(stderr, "indirect offs=%jd\n", off);
                }
                switch (in_type = cvt_flip(m->in_type, flip)) {
                case FILE_BYTE:
                        if (OFFSET_OOB(nbytes, offset, 1))
                                return 0;
-                       if (off) {
-                               switch (m->in_op & FILE_OPS_MASK) {
-                               case FILE_OPAND:
-                                       offset = p->b & off;
-                                       break;
-                               case FILE_OPOR:
-                                       offset = p->b | off;
-                                       break;
-                               case FILE_OPXOR:
-                                       offset = p->b ^ off;
-                                       break;
-                               case FILE_OPADD:
-                                       offset = p->b + off;
-                                       break;
-                               case FILE_OPMINUS:
-                                       offset = p->b - off;
-                                       break;
-                               case FILE_OPMULTIPLY:
-                                       offset = p->b * off;
-                                       break;
-                               case FILE_OPDIVIDE:
-                                       offset = p->b / off;
-                                       break;
-                               case FILE_OPMODULO:
-                                       offset = p->b % off;
-                                       break;
-                               }
-                       } else
-                               offset = p->b;
-                       if (m->in_op & FILE_OPINVERSE)
-                               offset = ~offset;
+                       offset = do_ops(m, SEXT(sgn,8,p->b), off);
                        break;
                case FILE_BESHORT:
                        if (OFFSET_OOB(nbytes, offset, 2))
                                return 0;
-                       lhs = (p->hs[0] << 8) | p->hs[1];
-                       if (off) {
-                               switch (m->in_op & FILE_OPS_MASK) {
-                               case FILE_OPAND:
-                                       offset = lhs & off;
-                                       break;
-                               case FILE_OPOR:
-                                       offset = lhs | off;
-                                       break;
-                               case FILE_OPXOR:
-                                       offset = lhs ^ off;
-                                       break;
-                               case FILE_OPADD:
-                                       offset = lhs + off;
-                                       break;
-                               case FILE_OPMINUS:
-                                       offset = lhs - off;
-                                       break;
-                               case FILE_OPMULTIPLY:
-                                       offset = lhs * off;
-                                       break;
-                               case FILE_OPDIVIDE:
-                                       offset = lhs / off;
-                                       break;
-                               case FILE_OPMODULO:
-                                       offset = lhs % off;
-                                       break;
-                               }
-                       } else
-                               offset = lhs;
-                       if (m->in_op & FILE_OPINVERSE)
-                               offset = ~offset;
+                       offset = do_ops(m, SEXT(sgn,16,BE16(p)), off);
                        break;
                case FILE_LESHORT:
                        if (OFFSET_OOB(nbytes, offset, 2))
                                return 0;
-                       lhs = (p->hs[1] << 8) | p->hs[0];
-                       if (off) {
-                               switch (m->in_op & FILE_OPS_MASK) {
-                               case FILE_OPAND:
-                                       offset = lhs & off;
-                                       break;
-                               case FILE_OPOR:
-                                       offset = lhs | off;
-                                       break;
-                               case FILE_OPXOR:
-                                       offset = lhs ^ off;
-                                       break;
-                               case FILE_OPADD:
-                                       offset = lhs + off;
-                                       break;
-                               case FILE_OPMINUS:
-                                       offset = lhs - off;
-                                       break;
-                               case FILE_OPMULTIPLY:
-                                       offset = lhs * off;
-                                       break;
-                               case FILE_OPDIVIDE:
-                                       offset = lhs / off;
-                                       break;
-                               case FILE_OPMODULO:
-                                       offset = lhs % off;
-                                       break;
-                               }
-                       } else
-                               offset = lhs;
-                       if (m->in_op & FILE_OPINVERSE)
-                               offset = ~offset;
+                       offset = do_ops(m, SEXT(sgn,16,LE16(p)), off);
                        break;
                case FILE_SHORT:
                        if (OFFSET_OOB(nbytes, offset, 2))
                                return 0;
-                       if (off) {
-                               switch (m->in_op & FILE_OPS_MASK) {
-                               case FILE_OPAND:
-                                       offset = p->h & off;
-                                       break;
-                               case FILE_OPOR:
-                                       offset = p->h | off;
-                                       break;
-                               case FILE_OPXOR:
-                                       offset = p->h ^ off;
-                                       break;
-                               case FILE_OPADD:
-                                       offset = p->h + off;
-                                       break;
-                               case FILE_OPMINUS:
-                                       offset = p->h - off;
-                                       break;
-                               case FILE_OPMULTIPLY:
-                                       offset = p->h * off;
-                                       break;
-                               case FILE_OPDIVIDE:
-                                       offset = p->h / off;
-                                       break;
-                               case FILE_OPMODULO:
-                                       offset = p->h % off;
-                                       break;
-                               }
-                       }
-                       else
-                               offset = p->h;
-                       if (m->in_op & FILE_OPINVERSE)
-                               offset = ~offset;
+                       offset = do_ops(m, SEXT(sgn,16,p->h), off);
                        break;
                case FILE_BELONG:
                case FILE_BEID3:
@@ -1524,38 +1442,8 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
                                return 0;
                        lhs = BE32(p);
                        if (in_type == FILE_BEID3)
-                               lhs = cvt_id3(ms, lhs);
-                       if (off) {
-                               switch (m->in_op & FILE_OPS_MASK) {
-                               case FILE_OPAND:
-                                       offset = lhs & off;
-                                       break;
-                               case FILE_OPOR:
-                                       offset = lhs | off;
-                                       break;
-                               case FILE_OPXOR:
-                                       offset = lhs ^ off;
-                                       break;
-                               case FILE_OPADD:
-                                       offset = lhs + off;
-                                       break;
-                               case FILE_OPMINUS:
-                                       offset = lhs - off;
-                                       break;
-                               case FILE_OPMULTIPLY:
-                                       offset = lhs * off;
-                                       break;
-                               case FILE_OPDIVIDE:
-                                       offset = lhs / off;
-                                       break;
-                               case FILE_OPMODULO:
-                                       offset = lhs % off;
-                                       break;
-                               }
-                       } else
-                               offset = lhs;
-                       if (m->in_op & FILE_OPINVERSE)
-                               offset = ~offset;
+                               lhs = cvt_id3(ms, (uint32_t)lhs);
+                       offset = do_ops(m, SEXT(sgn,32,lhs), off);
                        break;
                case FILE_LELONG:
                case FILE_LEID3:
@@ -1563,109 +1451,18 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
                                return 0;
                        lhs = LE32(p);
                        if (in_type == FILE_LEID3)
-                               lhs = cvt_id3(ms, lhs);
-                       if (off) {
-                               switch (m->in_op & FILE_OPS_MASK) {
-                               case FILE_OPAND:
-                                       offset = lhs & off;
-                                       break;
-                               case FILE_OPOR:
-                                       offset = lhs | off;
-                                       break;
-                               case FILE_OPXOR:
-                                       offset = lhs ^ off;
-                                       break;
-                               case FILE_OPADD:
-                                       offset = lhs + off;
-                                       break;
-                               case FILE_OPMINUS:
-                                       offset = lhs - off;
-                                       break;
-                               case FILE_OPMULTIPLY:
-                                       offset = lhs * off;
-                                       break;
-                               case FILE_OPDIVIDE:
-                                       offset = lhs / off;
-                                       break;
-                               case FILE_OPMODULO:
-                                       offset = lhs % off;
-                                       break;
-                               }
-                       } else
-                               offset = lhs;
-                       if (m->in_op & FILE_OPINVERSE)
-                               offset = ~offset;
+                               lhs = cvt_id3(ms, (uint32_t)lhs);
+                       offset = do_ops(m, SEXT(sgn,32,lhs), off);
                        break;
                case FILE_MELONG:
                        if (OFFSET_OOB(nbytes, offset, 4))
                                return 0;
-                       lhs = ME32(p);
-                       if (off) {
-                               switch (m->in_op & FILE_OPS_MASK) {
-                               case FILE_OPAND:
-                                       offset = lhs & off;
-                                       break;
-                               case FILE_OPOR:
-                                       offset = lhs | off;
-                                       break;
-                               case FILE_OPXOR:
-                                       offset = lhs ^ off;
-                                       break;
-                               case FILE_OPADD:
-                                       offset = lhs + off;
-                                       break;
-                               case FILE_OPMINUS:
-                                       offset = lhs - off;
-                                       break;
-                               case FILE_OPMULTIPLY:
-                                       offset = lhs * off;
-                                       break;
-                               case FILE_OPDIVIDE:
-                                       offset = lhs / off;
-                                       break;
-                               case FILE_OPMODULO:
-                                       offset = lhs % off;
-                                       break;
-                               }
-                       } else
-                               offset = lhs;
-                       if (m->in_op & FILE_OPINVERSE)
-                               offset = ~offset;
+                       offset = do_ops(m, SEXT(sgn,32,ME32(p)), off);
                        break;
                case FILE_LONG:
                        if (OFFSET_OOB(nbytes, offset, 4))
                                return 0;
-                       if (off) {
-                               switch (m->in_op & FILE_OPS_MASK) {
-                               case FILE_OPAND:
-                                       offset = p->l & off;
-                                       break;
-                               case FILE_OPOR:
-                                       offset = p->l | off;
-                                       break;
-                               case FILE_OPXOR:
-                                       offset = p->l ^ off;
-                                       break;
-                               case FILE_OPADD:
-                                       offset = p->l + off;
-                                       break;
-                               case FILE_OPMINUS:
-                                       offset = p->l - off;
-                                       break;
-                               case FILE_OPMULTIPLY:
-                                       offset = p->l * off;
-                                       break;
-                               case FILE_OPDIVIDE:
-                                       offset = p->l / off;
-                                       break;
-                               case FILE_OPMODULO:
-                                       offset = p->l % off;
-                                       break;
-                               }
-                       } else
-                               offset = p->l;
-                       if (m->in_op & FILE_OPINVERSE)
-                               offset = ~offset;
+                       offset = do_ops(m, SEXT(sgn,32,p->l), off);
                        break;
                default:
                        break;
@@ -2078,7 +1875,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
                        size_t slen = ms->search.s_len;
                        char *copy;
                        if (slen != 0) {
-                           copy = malloc(slen);
+                           copy = CAST(char *, malloc(slen));
                            if (copy == NULL)  {
                                file_regfree(&rx);
                                file_error(ms, errno,
@@ -2231,19 +2028,25 @@ magiccheck(struct magic_set *ms, struct magic *m)
 }
 
 private int
-handle_annotation(struct magic_set *ms, struct magic *m)
+handle_annotation(struct magic_set *ms, struct magic *m, int firstline)
 {
        if ((ms->flags & MAGIC_APPLE) && m->apple[0]) {
+               if (!firstline && file_printf(ms, "\n- ") == -1)
+                       return -1;
                if (file_printf(ms, "%.8s", m->apple) == -1)
                        return -1;
                return 1;
        }
        if ((ms->flags & MAGIC_EXTENSION) && m->ext[0]) {
+               if (!firstline && file_printf(ms, "\n- ") == -1)
+                       return -1;
                if (file_printf(ms, "%s", m->ext) == -1)
                        return -1;
                return 1;
        }
        if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) {
+               if (!firstline && file_printf(ms, "\n- ") == -1)
+                       return -1;
                if (file_printf(ms, "%s", m->mimetype) == -1)
                        return -1;
                return 1;
@@ -2254,8 +2057,8 @@ handle_annotation(struct magic_set *ms, struct magic *m)
 private int
 print_sep(struct magic_set *ms, int firstline)
 {
-       if (ms->flags & MAGIC_NODESC)
-               return 0;
+//     if (ms->flags & MAGIC_NODESC)
+//             return 0;
        if (firstline)
                return 0;
        /*
diff --git a/tests/zstd-3-skippable-frames.result b/tests/zstd-3-skippable-frames.result
new file mode 100644 (file)
index 0000000..468070c
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: 1
\ No newline at end of file
diff --git a/tests/zstd-dictionary-0.result b/tests/zstd-dictionary-0.result
new file mode 100644 (file)
index 0000000..e1b9c62
--- /dev/null
@@ -0,0 +1 @@
+Zstandard dictionary (ID 0)
\ No newline at end of file
diff --git a/tests/zstd-dictionary-1.result b/tests/zstd-dictionary-1.result
new file mode 100644 (file)
index 0000000..dd9f5f1
--- /dev/null
@@ -0,0 +1 @@
+Zstandard dictionary (ID 1)
\ No newline at end of file
diff --git a/tests/zstd-dictionary-2.result b/tests/zstd-dictionary-2.result
new file mode 100644 (file)
index 0000000..e1ac5b3
--- /dev/null
@@ -0,0 +1 @@
+Zstandard dictionary (ID 285212672)
\ No newline at end of file
diff --git a/tests/zstd-skippable-frame-0.result b/tests/zstd-skippable-frame-0.result
new file mode 100644 (file)
index 0000000..a4e3e48
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.2)
\ No newline at end of file
diff --git a/tests/zstd-skippable-frame-4.result b/tests/zstd-skippable-frame-4.result
new file mode 100644 (file)
index 0000000..cecb5e7
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.3)
\ No newline at end of file
diff --git a/tests/zstd-skippable-frame-8.result b/tests/zstd-skippable-frame-8.result
new file mode 100644 (file)
index 0000000..528f701
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.4)
\ No newline at end of file
diff --git a/tests/zstd-skippable-frame-C.result b/tests/zstd-skippable-frame-C.result
new file mode 100644 (file)
index 0000000..468070c
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: 1
\ No newline at end of file
diff --git a/tests/zstd-v0.2-FF.result b/tests/zstd-v0.2-FF.result
new file mode 100644 (file)
index 0000000..a4e3e48
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.2)
\ No newline at end of file
diff --git a/tests/zstd-v0.2-FF.testfile b/tests/zstd-v0.2-FF.testfile
new file mode 100644 (file)
index 0000000..6fe4f27
--- /dev/null
@@ -0,0 +1 @@
+"µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.3-FF.result b/tests/zstd-v0.3-FF.result
new file mode 100644 (file)
index 0000000..cecb5e7
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.3)
\ No newline at end of file
diff --git a/tests/zstd-v0.3-FF.testfile b/tests/zstd-v0.3-FF.testfile
new file mode 100644 (file)
index 0000000..dc50469
--- /dev/null
@@ -0,0 +1 @@
+#µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.4-FF.result b/tests/zstd-v0.4-FF.result
new file mode 100644 (file)
index 0000000..528f701
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.4)
\ No newline at end of file
diff --git a/tests/zstd-v0.4-FF.testfile b/tests/zstd-v0.4-FF.testfile
new file mode 100644 (file)
index 0000000..f2768a2
--- /dev/null
@@ -0,0 +1 @@
+$µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.5-FF.result b/tests/zstd-v0.5-FF.result
new file mode 100644 (file)
index 0000000..815c80d
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.5)
\ No newline at end of file
diff --git a/tests/zstd-v0.5-FF.testfile b/tests/zstd-v0.5-FF.testfile
new file mode 100644 (file)
index 0000000..a25f337
--- /dev/null
@@ -0,0 +1 @@
+%µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.6-FF.result b/tests/zstd-v0.6-FF.result
new file mode 100644 (file)
index 0000000..b28af6b
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.6)
\ No newline at end of file
diff --git a/tests/zstd-v0.6-FF.testfile b/tests/zstd-v0.6-FF.testfile
new file mode 100644 (file)
index 0000000..1c8ca59
--- /dev/null
@@ -0,0 +1 @@
+&µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.7-00.result b/tests/zstd-v0.7-00.result
new file mode 100644 (file)
index 0000000..72e0e27
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.7), Dictionary ID: None
\ No newline at end of file
diff --git a/tests/zstd-v0.7-21.result b/tests/zstd-v0.7-21.result
new file mode 100644 (file)
index 0000000..a4d43c8
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.7), Dictionary ID: 1
\ No newline at end of file
diff --git a/tests/zstd-v0.7-21.testfile b/tests/zstd-v0.7-21.testfile
new file mode 100644 (file)
index 0000000..b40294e
--- /dev/null
@@ -0,0 +1 @@
+'µ/ý!\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.7-22.result b/tests/zstd-v0.7-22.result
new file mode 100644 (file)
index 0000000..b4336c9
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.7), Dictionary ID: 513
\ No newline at end of file
diff --git a/tests/zstd-v0.7-22.testfile b/tests/zstd-v0.7-22.testfile
new file mode 100644 (file)
index 0000000..8b72d68
--- /dev/null
@@ -0,0 +1 @@
+'µ/ý"\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.8-00.result b/tests/zstd-v0.8-00.result
new file mode 100644 (file)
index 0000000..67edebd
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: None
\ No newline at end of file
diff --git a/tests/zstd-v0.8-01.result b/tests/zstd-v0.8-01.result
new file mode 100644 (file)
index 0000000..a1239a7
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: 2
\ No newline at end of file
diff --git a/tests/zstd-v0.8-01.testfile b/tests/zstd-v0.8-01.testfile
new file mode 100644 (file)
index 0000000..88735e4
--- /dev/null
@@ -0,0 +1 @@
+(µ/ý\ 1\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.8-02.result b/tests/zstd-v0.8-02.result
new file mode 100644 (file)
index 0000000..82beab8
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: 770
\ No newline at end of file
diff --git a/tests/zstd-v0.8-02.testfile b/tests/zstd-v0.8-02.testfile
new file mode 100644 (file)
index 0000000..db55433
--- /dev/null
@@ -0,0 +1 @@
+(µ/ý\ 2\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.8-03.result b/tests/zstd-v0.8-03.result
new file mode 100644 (file)
index 0000000..6aaaa19
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: 84148994
\ No newline at end of file
diff --git a/tests/zstd-v0.8-03.testfile b/tests/zstd-v0.8-03.testfile
new file mode 100644 (file)
index 0000000..506b344
--- /dev/null
@@ -0,0 +1 @@
+(µ/ý\ 3\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.8-16.result b/tests/zstd-v0.8-16.result
new file mode 100644 (file)
index 0000000..82beab8
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: 770
\ No newline at end of file
diff --git a/tests/zstd-v0.8-16.testfile b/tests/zstd-v0.8-16.testfile
new file mode 100644 (file)
index 0000000..3f87f79
--- /dev/null
@@ -0,0 +1 @@
+(µ/ý\16\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.8-20.result b/tests/zstd-v0.8-20.result
new file mode 100644 (file)
index 0000000..67edebd
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: None
\ No newline at end of file
diff --git a/tests/zstd-v0.8-20.testfile b/tests/zstd-v0.8-20.testfile
new file mode 100644 (file)
index 0000000..76fdbb8
--- /dev/null
@@ -0,0 +1 @@
+(µ/ý \ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.8-21.result b/tests/zstd-v0.8-21.result
new file mode 100644 (file)
index 0000000..468070c
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: 1
\ No newline at end of file
diff --git a/tests/zstd-v0.8-21.testfile b/tests/zstd-v0.8-21.testfile
new file mode 100644 (file)
index 0000000..9ebeff4
--- /dev/null
@@ -0,0 +1 @@
+(µ/ý!\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.8-22.result b/tests/zstd-v0.8-22.result
new file mode 100644 (file)
index 0000000..9869d24
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: 513
\ No newline at end of file
diff --git a/tests/zstd-v0.8-22.testfile b/tests/zstd-v0.8-22.testfile
new file mode 100644 (file)
index 0000000..f2e55bf
--- /dev/null
@@ -0,0 +1 @@
+(µ/ý"\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.8-23.result b/tests/zstd-v0.8-23.result
new file mode 100644 (file)
index 0000000..d38420f
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: 67305985
\ No newline at end of file
diff --git a/tests/zstd-v0.8-23.testfile b/tests/zstd-v0.8-23.testfile
new file mode 100644 (file)
index 0000000..f66a18f
--- /dev/null
@@ -0,0 +1 @@
+(µ/ý#\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.8-F4.result b/tests/zstd-v0.8-F4.result
new file mode 100644 (file)
index 0000000..67edebd
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: None
\ No newline at end of file
diff --git a/tests/zstd-v0.8-F4.testfile b/tests/zstd-v0.8-F4.testfile
new file mode 100644 (file)
index 0000000..a4e4240
--- /dev/null
@@ -0,0 +1 @@
+(µ/ýô\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file
diff --git a/tests/zstd-v0.8-FF.result b/tests/zstd-v0.8-FF.result
new file mode 100644 (file)
index 0000000..d38420f
--- /dev/null
@@ -0,0 +1 @@
+Zstandard compressed data (v0.8+), Dictionary ID: 67305985
\ No newline at end of file
diff --git a/tests/zstd-v0.8-FF.testfile b/tests/zstd-v0.8-FF.testfile
new file mode 100644 (file)
index 0000000..bc63911
--- /dev/null
@@ -0,0 +1 @@
+(µ/ýÿ\ 1\ 2\ 3\ 4\ 5
\ No newline at end of file