Hello community,

here is the log from the commit of package file for openSUSE:Factory checked in 
at 2017-03-08 00:42:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/file (Old)
 and      /work/SRC/openSUSE:Factory/.file.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "file"

Wed Mar  8 00:42:01 2017 rev:99 rq:461937 version:5.30

Changes:
--------
--- /work/SRC/openSUSE:Factory/file/file.changes        2016-12-03 
18:23:01.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.file.new/file.changes   2017-03-08 
00:42:02.357753522 +0100
@@ -1,0 +2,21 @@
+Thu Mar  2 13:22:39 UTC 2017 - wer...@suse.de
+
+- Update to file version 5.30
+  * If we exceeded the offset in a search return no match
+    (Christoph Biedl)
+  * Be more lenient on corrupt CDF files (Christoph Biedl)
+  * pacify ubsan sign extension (oss-fuzz/524)
+  * off by one in cdf parsing (PR/593)
+  * report debugging sections in elf (PR/591)
+  * Allow @@@ in extensions
+  * Add missing overflow check in der magic (Jonas Wagner)
+- Mofify the patches
+    file-5.16-ocloexec.patch
+    file-5.19-biorad.dif
+    file-5.28-btrfs-image.dif
+- Rename patch file-5.29.dif to file-5.30.dif
+- Add upstream patches
+    file-5.30-150735.patch
+    file-5.30-3c60e5.patch
+
+-------------------------------------------------------------------
python3-magic.changes: same change

Old:
----
  file-5.29.dif
  file-5.29.tar.gz

New:
----
  file-5.30-150735.patch
  file-5.30-3c60e5.patch
  file-5.30.dif
  file-5.30.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ file.spec ++++++
--- /var/tmp/diff_new_pack.JutS76/_old  2017-03-08 00:42:04.637431328 +0100
+++ /var/tmp/diff_new_pack.JutS76/_new  2017-03-08 00:42:04.645430199 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package file
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -32,7 +32,7 @@
 %endif
 #
 # Set Version also in python-magic.spec
-Version:        5.29
+Version:        5.30
 Release:        0
 Summary:        A Tool to Determine File Types
 License:        BSD-2-Clause
@@ -40,7 +40,7 @@
 Source:         ftp://ftp.astron.com/pub/file/file-%{version}.tar.gz
 Source2:        baselibs.conf
 Source3:        file-rpmlintrc
-Patch:          file-5.29.dif
+Patch:          file-5.30.dif
 Patch1:         file-5.19-misc.dif
 Patch4:         file-4.24-autoconf.dif
 Patch5:         file-5.14-tex.dif
@@ -64,6 +64,9 @@
 Patch36:        file-5.15-clear-invalid.patch
 Patch37:        file-secure_getenv.patch
 Patch39:        file-5.28-btrfs-image.dif
+# upstream fixes
+Patch40:        file-5.30-150735.patch
+Patch41:        file-5.30-3c60e5.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %global         _sysconfdir /etc
 %global         _miscdir    %{_datadir}/misc
@@ -109,6 +112,8 @@
 
 %prep
 %setup -q -n file-%{version}
+%patch40 -p1 -b .p40
+%patch41 -p1 -b .p41
 %patch1  -p0 -b .misc
 %patch4  -p0 -b .conf
 %patch5  -p0 -b .tex

++++++ python-magic.spec ++++++
--- /var/tmp/diff_new_pack.JutS76/_old  2017-03-08 00:42:04.673426242 +0100
+++ /var/tmp/diff_new_pack.JutS76/_new  2017-03-08 00:42:04.677425676 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-magic
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -28,7 +28,7 @@
 BuildRequires:  python-setuptools
 BuildRequires:  zlib-devel
 Url:            http://www.darwinsys.com/file/
-Version:        5.29
+Version:        5.30
 Release:        0
 Summary:        Python module to use libmagic
 License:        BSD-3-Clause and BSD-4-Clause

python3-magic.spec: same change
++++++ file-5.16-ocloexec.patch ++++++
--- /var/tmp/diff_new_pack.JutS76/_old  2017-03-08 00:42:04.781410979 +0100
+++ /var/tmp/diff_new_pack.JutS76/_new  2017-03-08 00:42:04.785410414 +0100
@@ -6,7 +6,7 @@
  4 files changed, 6 insertions(+), 6 deletions(-)
 
 --- src/apprentice.c
-+++ src/apprentice.c   2016-11-24 09:09:50.912104836 +0000
++++ src/apprentice.c   2017-03-02 13:18:27.595290990 +0000
 @@ -1102,7 +1102,7 @@ load_1(struct magic_set *ms, int action,
        ssize_t len;
        struct magic_entry me;
@@ -35,8 +35,8 @@
                file_error(ms, errno, "cannot open `%s'", dbname);
                goto out;
 --- src/compress.c
-+++ src/compress.c     2016-11-24 09:09:50.912104836 +0000
-@@ -393,7 +393,7 @@ file_pipe2file(struct magic_set *ms, int
++++ src/compress.c     2017-03-02 13:18:27.595290990 +0000
+@@ -394,7 +394,7 @@ file_pipe2file(struct magic_set *ms, int
  #else
        {
                int te;
@@ -46,7 +46,7 @@
                (void)unlink(buf);
                errno = te;
 --- src/file.c
-+++ src/file.c 2016-11-24 09:09:50.912104836 +0000
++++ src/file.c 2017-03-02 13:18:27.595290990 +0000
 @@ -471,7 +471,7 @@ unwrap(struct magic_set *ms, const char
                f = stdin;
                wid = 1;
@@ -57,7 +57,7 @@
                            progname, fn, strerror(errno));
                        return 1;
 --- src/magic.c
-+++ src/magic.c        2016-11-24 09:09:50.912104836 +0000
++++ src/magic.c        2017-03-02 13:18:27.595290990 +0000
 @@ -442,7 +442,7 @@ file_or_fd(struct magic_set *ms, const c
                else
                        pos = lseek(fd, (off_t)0, SEEK_CUR);

++++++ file-5.19-biorad.dif ++++++
--- /var/tmp/diff_new_pack.JutS76/_old  2017-03-08 00:42:04.801408153 +0100
+++ /var/tmp/diff_new_pack.JutS76/_new  2017-03-08 00:42:04.801408153 +0100
@@ -3,8 +3,8 @@
  1 file changed, 2 insertions(+)
 
 --- magic/Magdir/images
-+++ magic/Magdir/images        2016-11-24 09:13:02.360240173 +0000
-@@ -1002,6 +1002,8 @@
++++ magic/Magdir/images        2017-03-02 13:17:22.400510894 +0000
+@@ -1007,6 +1007,8 @@
  # 
http://web.archive.org/web/20050317223257/www.cs.ubc.ca/spider/ladic/text/biorad.txt
  # Samples: http://www.loci.wisc.edu/software/sample-data
  14    leshort <2

++++++ file-5.28-btrfs-image.dif ++++++
--- /var/tmp/diff_new_pack.JutS76/_old  2017-03-08 00:42:04.857400240 +0100
+++ /var/tmp/diff_new_pack.JutS76/_new  2017-03-08 00:42:04.857400240 +0100
@@ -8,15 +8,15 @@
 superblock.  Rather than duplicate the superblock printer, split
 that out and use it with both the on-disk superblock and the ones
 contained within the image.
+
 ---
- magic/Magdir/filesystems | 37 +++++++++++++++++++++++--------------
+ magic/Magdir/filesystems |   37 +++++++++++++++++++++++--------------
  1 file changed, 23 insertions(+), 14 deletions(-)
 
 diff --git a/magic/Magdir/filesystems b/magic/Magdir/filesystems
-index 1e8e8a8..2579f48 100644
 --- a/magic/Magdir/filesystems
 +++ b/magic/Magdir/filesystems
-@@ -2210,20 +2210,29 @@
+@@ -2229,20 +2229,29 @@
  >>0x10060        string          >\0             lockproto %s)
  
  # Russell Coker <russ...@coker.com.au>
@@ -52,10 +52,10 @@
 +>0x70         lequad  x               \b%lld bytes used,
 +>0x88         lequad  x               %lld devices
 +
-+0             lequad  0xbd5c25e27295668b      BTRFS Filesystem Metadata Image
-+>20           byte    1                       \b, zlib compressed
-+>20           byte    0                       \b, uncompressed
-+>>0x440               string  _BHRfS_M                \b, contains
++0             lequad  0xbd5c25e27295668b      BTRFS Filesystem Metadata Image
++>20           byte    1                       \b, zlib compressed
++>20           byte    0                       \b, uncompressed
++>>0x440               string  _BHRfS_M                \b, contains
 +>>>0x400      use                             btrfs_super_block
  
  # dvdisaster's .ecc

++++++ file-5.30-150735.patch ++++++
>From 1507352bc5cbdebaa9f64f1c73876ec9d8a638bc Mon Sep 17 00:00:00 2001
From: Christos Zoulas <chris...@zoulas.com>
Date: Tue, 14 Feb 2017 12:56:48 +0000
Subject: [PATCH] keep "[not] stripped" last since some scripts expect it to be
 there.

---
 src/readelf.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/readelf.c b/src/readelf.c
index d1b71cf..3695c89 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -1373,12 +1373,12 @@ doshn(struct magic_set *ms, int clazz, int swap, int 
fd, off_t off, int num,
                }
        }
 
-       if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
-               return -1;
        if (has_debug_info) {
                if (file_printf(ms, ", with debug_info") == -1)
                        return -1;
        }
+       if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
+               return -1;
        if (cap_hw1) {
                const cap_desc_t *cdp;
                switch (mach) {
++++++ file-5.30-3c60e5.patch ++++++
>From 3c60e59aee7425ba599d208678b62efa9a4a1d3f Mon Sep 17 00:00:00 2001
From: Christos Zoulas <chris...@zoulas.com>
Date: Tue, 21 Feb 2017 18:34:55 +0000
Subject: [PATCH] bump perl to exceed 'c'

---
 magic/Magdir/perl |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/magic/Magdir/perl b/magic/Magdir/perl
index bbe10ba..3423b5c 100644
--- a/magic/Magdir/perl
+++ b/magic/Magdir/perl
@@ -33,14 +33,14 @@
 
 # by Dmitry V. Levin and Alexey Tourbin
 # check the first line
-0      search/1024     package
+0      search/8192     package
 >0     regex           \^package[\ \t]+[0-9A-Za-z_:]+\ *;      Perl5 module 
 >source text
-!:strength + 10
+!:strength + 40
 # not 'p', check other lines
-0      search/1024     !p
+0      search/8192     !p
 >0     regex           \^package[\ \t]+[0-9A-Za-z_:]+\ *;
 >>0    regex           \^1\ *;|\^(use|sub|my)\ .*[(;{=]        Perl5 module 
 >>source text
-!:strength + 10
+!:strength + 75
 
 # Perl POD documents
 # From: Tom Hukins <t...@eborcom.com>
++++++ file-5.29.dif -> file-5.30.dif ++++++
--- /work/SRC/openSUSE:Factory/file/file-5.29.dif       2016-12-03 
18:23:01.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.file.new/file-5.30.dif  2017-03-08 
00:42:02.309760305 +0100
@@ -10,7 +10,7 @@
  8 files changed, 312 insertions(+), 67 deletions(-)
 
 --- magic/Magdir/elf
-+++ magic/Magdir/elf   2016-11-24 09:14:28.650497856 +0000
++++ magic/Magdir/elf   2017-03-02 13:21:26.971933119 +0000
 @@ -128,7 +128,7 @@
  >18   leshort         47              Renesas H8/300H,
  >18   leshort         48              Renesas H8S,
@@ -21,7 +21,7 @@
  >18   leshort         52              Motorola Coldfire,
  >18   leshort         53              Motorola M68HC12,
 --- magic/Magdir/linux
-+++ magic/Magdir/linux 2016-11-24 09:14:28.650497856 +0000
++++ magic/Magdir/linux 2017-03-02 13:21:26.971933119 +0000
 @@ -101,23 +101,27 @@
  # and Nicolas Lichtmaier <n...@debian.org>
  # All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29
@@ -67,7 +67,7 @@
  0             belong  0xb8c0078e      Linux kernel
  >0x1e3                string  Loading         version 1.3.79 or older
 --- magic/Magdir/msad
-+++ magic/Magdir/msad  2016-11-24 09:14:28.650497856 +0000
++++ magic/Magdir/msad  2017-03-02 13:21:26.971933119 +0000
 @@ -0,0 +1,5 @@
 
+#------------------------------------------------------------------------------
 +# msad:  file(1) magic for msad
@@ -75,7 +75,7 @@
 +# This must precede the heuristic for raw G3 data
 +4     string  Standard\ Jet\ DB       Microsoft Access Database
 --- magic/Magdir/msdos
-+++ magic/Magdir/msdos 2016-11-30 12:48:39.837023419 +0000
++++ magic/Magdir/msdos 2017-03-02 13:21:26.971933119 +0000
 @@ -104,9 +104,9 @@
  >>>(0x3c.l+22)        leshort&0x0200  >0      (stripped to external PDB)
  >>>(0x3c.l+22)        leshort&0x1000  >0      system file
@@ -98,7 +98,7 @@
  
  # updated by Joerg Jenderek at Oct 2008,2015
 --- magic/Makefile.am
-+++ magic/Makefile.am  2016-11-24 09:15:11.733627853 +0000
++++ magic/Makefile.am  2017-03-02 13:21:26.971933119 +0000
 @@ -5,7 +5,7 @@ MAGIC_FRAGMENT_BASE = Magdir
  MAGIC_DIR = $(top_srcdir)/magic
  MAGIC_FRAGMENT_DIR = $(MAGIC_DIR)/$(MAGIC_FRAGMENT_BASE)
@@ -124,7 +124,7 @@
  $(MAGIC_FRAGMENT_DIR)/finger \
  $(MAGIC_FRAGMENT_DIR)/flash \
  $(MAGIC_FRAGMENT_DIR)/flif \
-@@ -125,6 +123,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
+@@ -126,6 +124,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
  $(MAGIC_FRAGMENT_DIR)/java \
  $(MAGIC_FRAGMENT_DIR)/javascript \
  $(MAGIC_FRAGMENT_DIR)/jpeg \
@@ -133,7 +133,7 @@
  $(MAGIC_FRAGMENT_DIR)/karma \
  $(MAGIC_FRAGMENT_DIR)/kde \
  $(MAGIC_FRAGMENT_DIR)/keepass \
-@@ -133,7 +133,6 @@ $(MAGIC_FRAGMENT_DIR)/kml \
+@@ -134,7 +134,6 @@ $(MAGIC_FRAGMENT_DIR)/kml \
  $(MAGIC_FRAGMENT_DIR)/lecter \
  $(MAGIC_FRAGMENT_DIR)/lex \
  $(MAGIC_FRAGMENT_DIR)/lif \
@@ -141,7 +141,7 @@
  $(MAGIC_FRAGMENT_DIR)/lisp \
  $(MAGIC_FRAGMENT_DIR)/llvm \
  $(MAGIC_FRAGMENT_DIR)/lua \
-@@ -141,7 +140,6 @@ $(MAGIC_FRAGMENT_DIR)/luks \
+@@ -142,7 +141,6 @@ $(MAGIC_FRAGMENT_DIR)/luks \
  $(MAGIC_FRAGMENT_DIR)/m4 \
  $(MAGIC_FRAGMENT_DIR)/mach \
  $(MAGIC_FRAGMENT_DIR)/macos \
@@ -149,7 +149,7 @@
  $(MAGIC_FRAGMENT_DIR)/magic \
  $(MAGIC_FRAGMENT_DIR)/mail.news \
  $(MAGIC_FRAGMENT_DIR)/make \
-@@ -163,10 +161,10 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
+@@ -164,10 +162,10 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
  $(MAGIC_FRAGMENT_DIR)/mkid \
  $(MAGIC_FRAGMENT_DIR)/mlssa \
  $(MAGIC_FRAGMENT_DIR)/mmdf \
@@ -161,7 +161,7 @@
  $(MAGIC_FRAGMENT_DIR)/msooxml \
  $(MAGIC_FRAGMENT_DIR)/msx \
  $(MAGIC_FRAGMENT_DIR)/msvc \
-@@ -218,6 +216,8 @@ $(MAGIC_FRAGMENT_DIR)/python \
+@@ -219,6 +217,8 @@ $(MAGIC_FRAGMENT_DIR)/python \
  $(MAGIC_FRAGMENT_DIR)/qt \
  $(MAGIC_FRAGMENT_DIR)/revision \
  $(MAGIC_FRAGMENT_DIR)/riff \
@@ -170,7 +170,7 @@
  $(MAGIC_FRAGMENT_DIR)/rpm \
  $(MAGIC_FRAGMENT_DIR)/rtf \
  $(MAGIC_FRAGMENT_DIR)/ruby \
-@@ -289,8 +289,20 @@ $(MAGIC_FRAGMENT_DIR)/zfs \
+@@ -291,8 +291,20 @@ $(MAGIC_FRAGMENT_DIR)/zfs \
  $(MAGIC_FRAGMENT_DIR)/zilog \
  $(MAGIC_FRAGMENT_DIR)/zyxel 
  
@@ -192,7 +192,7 @@
  
  # FIXME: Build file natively as well so that it can be used to compile
  # the target's magic file; for now we bail if the local version does not match
-@@ -302,19 +314,22 @@ FILE_COMPILE = $(top_builddir)/src/file$
+@@ -304,19 +316,22 @@ FILE_COMPILE = $(top_builddir)/src/file$
  FILE_COMPILE_DEP = $(FILE_COMPILE)
  endif
  
@@ -232,7 +232,7 @@
 +#     $(FILE_COMPILE) -C -m magic
 +#     @rm -fr magic
 --- magic/Makefile.in
-+++ magic/Makefile.in  2016-11-24 09:15:28.789283420 +0000
++++ magic/Makefile.in  2017-03-02 13:21:26.971933119 +0000
 @@ -278,7 +278,7 @@ top_srcdir = @top_srcdir@
  MAGIC_FRAGMENT_BASE = Magdir
  MAGIC_DIR = $(top_srcdir)/magic
@@ -258,7 +258,7 @@
  $(MAGIC_FRAGMENT_DIR)/finger \
  $(MAGIC_FRAGMENT_DIR)/flash \
  $(MAGIC_FRAGMENT_DIR)/flif \
-@@ -397,6 +395,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
+@@ -398,6 +396,8 @@ $(MAGIC_FRAGMENT_DIR)/isz \
  $(MAGIC_FRAGMENT_DIR)/java \
  $(MAGIC_FRAGMENT_DIR)/javascript \
  $(MAGIC_FRAGMENT_DIR)/jpeg \
@@ -267,7 +267,7 @@
  $(MAGIC_FRAGMENT_DIR)/karma \
  $(MAGIC_FRAGMENT_DIR)/kde \
  $(MAGIC_FRAGMENT_DIR)/keepass \
-@@ -405,7 +405,6 @@ $(MAGIC_FRAGMENT_DIR)/kml \
+@@ -406,7 +406,6 @@ $(MAGIC_FRAGMENT_DIR)/kml \
  $(MAGIC_FRAGMENT_DIR)/lecter \
  $(MAGIC_FRAGMENT_DIR)/lex \
  $(MAGIC_FRAGMENT_DIR)/lif \
@@ -275,7 +275,7 @@
  $(MAGIC_FRAGMENT_DIR)/lisp \
  $(MAGIC_FRAGMENT_DIR)/llvm \
  $(MAGIC_FRAGMENT_DIR)/lua \
-@@ -413,7 +412,6 @@ $(MAGIC_FRAGMENT_DIR)/luks \
+@@ -414,7 +413,6 @@ $(MAGIC_FRAGMENT_DIR)/luks \
  $(MAGIC_FRAGMENT_DIR)/m4 \
  $(MAGIC_FRAGMENT_DIR)/mach \
  $(MAGIC_FRAGMENT_DIR)/macos \
@@ -283,7 +283,7 @@
  $(MAGIC_FRAGMENT_DIR)/magic \
  $(MAGIC_FRAGMENT_DIR)/mail.news \
  $(MAGIC_FRAGMENT_DIR)/make \
-@@ -435,10 +433,10 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
+@@ -436,10 +434,10 @@ $(MAGIC_FRAGMENT_DIR)/misctools \
  $(MAGIC_FRAGMENT_DIR)/mkid \
  $(MAGIC_FRAGMENT_DIR)/mlssa \
  $(MAGIC_FRAGMENT_DIR)/mmdf \
@@ -295,7 +295,7 @@
  $(MAGIC_FRAGMENT_DIR)/msooxml \
  $(MAGIC_FRAGMENT_DIR)/msx \
  $(MAGIC_FRAGMENT_DIR)/msvc \
-@@ -490,6 +488,8 @@ $(MAGIC_FRAGMENT_DIR)/python \
+@@ -491,6 +489,8 @@ $(MAGIC_FRAGMENT_DIR)/python \
  $(MAGIC_FRAGMENT_DIR)/qt \
  $(MAGIC_FRAGMENT_DIR)/revision \
  $(MAGIC_FRAGMENT_DIR)/riff \
@@ -304,7 +304,7 @@
  $(MAGIC_FRAGMENT_DIR)/rpm \
  $(MAGIC_FRAGMENT_DIR)/rtf \
  $(MAGIC_FRAGMENT_DIR)/ruby \
-@@ -561,10 +561,22 @@ $(MAGIC_FRAGMENT_DIR)/zfs \
+@@ -563,10 +563,22 @@ $(MAGIC_FRAGMENT_DIR)/zfs \
  $(MAGIC_FRAGMENT_DIR)/zilog \
  $(MAGIC_FRAGMENT_DIR)/zyxel 
  
@@ -328,7 +328,7 @@
  # FIXME: Build file natively as well so that it can be used to compile
  # the target's magic file; for now we bail if the local version does not match
  @IS_CROSS_COMPILE_TRUE@FILE_COMPILE = file${EXEEXT}
-@@ -786,23 +798,25 @@ uninstall-am: uninstall-pkgdataDATA
+@@ -788,23 +800,25 @@ uninstall-am: uninstall-pkgdataDATA
  
  .PRECIOUS: Makefile
  
@@ -371,7 +371,7 @@
  # Tell versions [3.59,3.63) of GNU make to not export all variables.
  # Otherwise a system limit (for SysV at least) may be exceeded.
 --- src/Makefile.am
-+++ src/Makefile.am    2016-11-24 09:14:28.686497129 +0000
++++ src/Makefile.am    2017-03-02 13:21:26.991932745 +0000
 @@ -1,4 +1,4 @@
 -MAGIC = $(pkgdatadir)/magic
 +MAGIC = $(sysconfdir)/magic:$(pkgdatadir)/magic
@@ -379,7 +379,7 @@
  nodist_include_HEADERS = magic.h
  
 --- src/dcore.c
-+++ src/dcore.c        2016-11-24 09:14:28.686497129 +0000
++++ src/dcore.c        2017-03-02 13:21:26.991932745 +0000
 @@ -0,0 +1,207 @@
 +/*
 + * Show goo about ELF core files

++++++ file-5.29.tar.gz -> file-5.30.tar.gz ++++++
++++ 1621 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/ChangeLog new/file-5.30/ChangeLog
--- old/file-5.29/ChangeLog     2016-10-25 16:39:43.000000000 +0200
+++ new/file-5.30/ChangeLog     2017-02-10 18:24:57.000000000 +0100
@@ -1,6 +1,30 @@
+2017-02-10  12:24  Christos Zoulas <chris...@zoulas.com>
+
+       * release 5.30
+
+2017-02-07  23:27  Christos Zoulas <chris...@zoulas.com>
+
+       * If we exceeded the offset in a search return no match
+         (Christoph Biedl)
+       * Be more lenient on corrupt CDF files (Christoph Biedl)
+
+2017-02-04  16:46  Christos Zoulas <chris...@zoulas.com>
+
+       * pacify ubsan sign extension (oss-fuzz/524)
+
+2017-02-01  12:42  Christos Zoulas <chris...@zoulas.com>
+
+       * off by one in cdf parsing (PR/593)
+       * report debugging sections in elf (PR/591)
+
+2016-11-06  10:52  Christos Zoulas <chris...@zoulas.com>
+
+       * Allow @@@ in extensions
+       * Add missing overflow check in der magic (Jonas Wagner)
+
 2016-10-25  10:40  Christos Zoulas <chris...@zoulas.com>
        
-       * release 5.28
+       * release 5.29
 
 2016-10-24  11:20  Christos Zoulas <chris...@zoulas.com>
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/configure.ac new/file-5.30/configure.ac
--- old/file-5.29/configure.ac  2016-10-25 16:39:16.000000000 +0200
+++ new/file-5.30/configure.ac  2017-02-10 18:24:21.000000000 +0100
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT([file],[5.29],[chris...@astron.com])
+AC_INIT([file],[5.30],[chris...@astron.com])
 AM_INIT_AUTOMAKE([subdir-objects foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/doc/file.man new/file-5.30/doc/file.man
--- old/file-5.29/doc/file.man  2016-10-19 22:52:45.000000000 +0200
+++ new/file-5.30/doc/file.man  2017-01-03 12:24:46.000000000 +0100
@@ -1,4 +1,4 @@
-.\" $File: file.man,v 1.124 2016/10/19 20:52:45 christos Exp $
+.\" $File: file.man,v 1.125 2017/01/03 11:24:46 christos Exp $
 .Dd October 19, 2016
 .Dt FILE __CSECTION__
 .Os
@@ -238,8 +238,8 @@
 to test the standard input, use
 .Sq -
 as a filename argument.
-Please note that 
-.Ar namefile 
+Please note that
+.Ar namefile
 is unwrapped and the enclosed filenames are processed when this option is
 encountered and before any further options processing is done.
 This allows one to process multiple lists of files with different command line
@@ -411,10 +411,10 @@
 .Fl h
 options.
 .Sh SEE ALSO
-.Xr magic __FSECTION__ ,
 .Xr hexdump 1 ,
 .Xr od 1 ,
 .Xr strings 1 ,
+.Xr magic __FSECTION__
 .Sh STANDARDS CONFORMANCE
 This program is believed to exceed the System V Interface Definition
 of FILE(CMD), as near as one can determine from the vague language
@@ -530,16 +530,15 @@
 the first version.
 Geoff Collyer found several inadequacies
 and provided some magic file entries.
-Contributions by the
+Contributions of the
 .Sq \*[Am]
 operator by Rob McMahon, 
 .Aq cu...@warwick.ac.uk ,
 1989.
 .Pp
-Guy Harris, 
+Guy Harris,
 .Aq g...@netapp.com ,
 made many changes from 1993 to the present.
-1989.
 .Pp
 Primary development and maintenance from 1990 to the present by
 Christos Zoulas
@@ -587,7 +586,6 @@
 .Nm
 returns 0 on success, and non-zero on error.
 .Sh BUGS
-.Pp
 Please report bugs and send patches to the bug tracker at
 .Pa http://bugs.gw.com/
 or the mailing list at
@@ -596,7 +594,6 @@
 .Pa http://mx.gw.com/mailman/listinfo/file
 first to subscribe).
 .Sh TODO
-.Pp
 Fix output so that tests for MIME and APPLE flags are not needed all
 over the place, and actual output is only done in one place.
 This needs a design.
@@ -645,16 +642,16 @@
 .Dq name
 and
 .Dq use
-to check for consistency at compile time (duplicate 
+to check for consistency at compile time (duplicate
 .Dq name ,
 .Dq use
 pointing to undefined
 .Dq name
 ).
-Make 
+Make
 .Dq name
 /
-.Dq use 
+.Dq use
 more efficient by keeping a sorted list of names.
 Special-case ^ to flip endianness in the parser so that it does not
 have to be escaped, and document it.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/doc/magic.man new/file-5.30/doc/magic.man
--- old/file-5.29/doc/magic.man 2016-09-16 14:06:13.000000000 +0200
+++ new/file-5.30/doc/magic.man 2017-02-08 22:52:03.000000000 +0100
@@ -1,5 +1,5 @@
-.\" $File: magic.man,v 1.88 2016/07/27 09:42:49 rrt Exp $
-.Dd July 20, 2016
+.\" $File: magic.man,v 1.90 2017/02/08 21:52:03 christos Exp $
+.Dd February 8, 2017
 .Dt MAGIC __FSECTION__
 .Os
 .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems.
@@ -7,7 +7,7 @@
 .Nm magic
 .Nd file command's magic pattern file
 .Sh DESCRIPTION
-This manual page documents the format of the magic file as
+This manual page documents the format of magic files as
 used by the
 .Xr file __CSECTION__
 command, version __VERSION__.
@@ -17,13 +17,19 @@
 among other tests,
 a test for whether the file contains certain
 .Dq "magic patterns" .
-The file
-.Pa __MAGIC__
-specifies what patterns are to be tested for, what message or
+The database of these
+.Dq "magic patterns"
+is usually located in a binary file in
+.Pa __MAGIC__.mgc
+or a directory of source text magic pattern fragment files in
+.Pa __MAGIC__ .
+The database specifies what patterns are to be tested for, what message or
 MIME type to print if a particular pattern is found,
 and additional information to extract from the file.
 .Pp
-Each line of the file specifies a test to be performed.
+The format of the source fragment files that are used to build this database
+is as follows:
+Each line of a fragment file specifies a test to be performed.
 A test compares the data starting at a particular offset
 in the file with a byte value, a string or a numeric value.
 If the test succeeds, a message is printed.
@@ -651,7 +657,7 @@
 \*[Gt]\*[Gt]\*[Gt]\*[Gt](\*[Am]0xe.l+(-4)) string       PK\e3\e4 \eb, ZIP 
self-extracting archive
 .Ed
 .Pp
-If you have a list of known avalues at a particular continuation level,
+If you have a list of known values at a particular continuation level,
 and you want to provide a switch-like default case:
 .Bd -literal -offset indent
 # clear that continuation level match
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/animation new/file-5.30/magic/Magdir/animation
--- old/file-5.29/magic/Magdir/animation        2016-07-03 16:13:11.000000000 
+0200
+++ new/file-5.30/magic/Magdir/animation        2017-01-21 17:07:14.000000000 
+0100
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: animation,v 1.58 2016/07/03 14:13:11 christos Exp $
+# $File: animation,v 1.59 2017/01/21 16:07:14 christos Exp $
 # animation:  file(1) magic for animation/movie formats
 #
 # animation formats
@@ -855,10 +855,12 @@
 
 # X3D (Extensible 3D) [http://www.web3d.org/specifications/x3d-3.0.dtd]
 # From Michel Briand <michelbri...@free.fr>
-0      string/t                \<?xml\ version="
-!:strength +1
->20    search/1000/cw  \<!DOCTYPE\ X3D         X3D (Extensible 3D) model xml 
text
-!:mime model/x3d
+# mimetype from https://www.iana.org/assignments/media-types/model/x3d+xml
+# Example 
http://www.web3d.org/x3d/content/examples/Basic/course/CreateX3DFromStringRandomSpheres.x3d
+0      string/w        \<?xml\ version=
+!:strength + 5
+>20    search/1000/w   \<!DOCTYPE\ X3D         X3D (Extensible 3D) model xml 
text
+!:mime model/x3d+xml
 
 #---------------------------------------------------------------------------
 # HVQM4: compressed movie format designed by Hudson for Nintendo GameCube
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/archive new/file-5.30/magic/Magdir/archive
--- old/file-5.29/magic/Magdir/archive  2016-05-05 19:07:40.000000000 +0200
+++ new/file-5.30/magic/Magdir/archive  2017-02-10 15:03:22.000000000 +0100
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: archive,v 1.103 2016/05/05 17:07:40 christos Exp $
+# $File: archive,v 1.104 2017/02/10 14:03:22 christos Exp $
 # archive:  file(1) magic for archive formats (see also "msdos" for self-
 #           extracting compressed archives)
 #
@@ -908,7 +908,17 @@
 >>>4   byte            0x0a            \b, at least v1.0 to extract
 >>>4   byte            0x0b            \b, at least v1.1 to extract
 >>>4   byte            0x14            \b, at least v2.0 to extract
+>>>4   byte            0x15            \b, at least v2.1 to extract
+>>>4   byte            0x19            \b, at least v2.5 to extract
+>>>4   byte            0x1b            \b, at least v2.7 to extract
 >>>4   byte            0x2d            \b, at least v4.5 to extract
+>>>4   byte            0x2e            \b, at least v4.6 to extract
+>>>4   byte            0x32            \b, at least v5.0 to extract
+>>>4   byte            0x33            \b, at least v5.1 to extract
+>>>4   byte            0x34            \b, at least v5.2 to extract
+>>>4   byte            0x3d            \b, at least v6.1 to extract
+>>>4   byte            0x3e            \b, at least v6.2 to extract
+>>>4   byte            0x3f            \b, at least v6.3 to extract
 >>>0x161       string          WINZIP          \b, WinZIP self-extracting
 
 # StarView Metafile
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/audio new/file-5.30/magic/Magdir/audio
--- old/file-5.29/magic/Magdir/audio    2016-03-02 19:27:24.000000000 +0100
+++ new/file-5.30/magic/Magdir/audio    2016-11-03 00:06:32.000000000 +0100
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: audio,v 1.75 2016/02/08 17:30:11 christos Exp $
+# $File: audio,v 1.76 2016/11/02 23:06:32 christos Exp $
 # audio:  file(1) magic for sound formats (see also "iff")
 #
 # Jan Nicolai Langfeldt (j...@ifi.uio.no), Dan Quinlan (quin...@yggdrasil.com),
@@ -469,6 +469,8 @@
 >>20   byte&0xe                0xc             \b, 7 channels
 >>20   byte&0xe                0xe             \b, 8 channels
 # some common sample rates
+>>17   belong&0xfffff0         0x2ee000        \b, 192 kHz
+>>17   belong&0xfffff0         0x158880        \b, 88.2 kHz
 >>17   belong&0xfffff0         0x0ac440        \b, 44.1 kHz
 >>17   belong&0xfffff0         0x0bb800        \b, 48 kHz
 >>17   belong&0xfffff0         0x07d000        \b, 32 kHz
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/console new/file-5.30/magic/Magdir/console
--- old/file-5.29/magic/Magdir/console  2016-06-12 19:05:45.000000000 +0200
+++ new/file-5.30/magic/Magdir/console  2017-02-08 22:53:06.000000000 +0100
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: console,v 1.26 2016/06/12 15:20:37 christos Exp $
+# $File: console,v 1.29 2017/02/08 21:53:06 christos Exp $
 # Console game magic
 # Toby Deshane <h...@shoelace.digivill.net>
 
@@ -9,17 +9,19 @@
 # References:
 # - http://wiki.nesdev.com/w/index.php/INES
 # - http://wiki.nesdev.com/w/index.php/NES_2.0
-0      string          NES\x1A         iNES ROM image
+
+# Common header for iNES, NES 2.0, and Wii U iNES.
+0      name            nes-rom-image-ines
 >7     byte&0x0C       =0x8            (NES 2.0)
 >4     byte            x               \b: %ux16k PRG
->5     byte            x               \b, %ux16k CHR
+>5     byte            x               \b, %ux8k CHR
 >6     byte&0x08       =0x8            [4-Scr]
 >6     byte&0x09       =0x0            [H-mirror]
 >6     byte&0x09       =0x1            [V-mirror]
 >6     byte&0x02       =0x2            [SRAM]
 >6     byte&0x04       =0x4            [Trainer]
 >7     byte&0x03       =0x2            [PC10]
->7     byte&0x03       =0x1            [VS
+>7     byte&0x03       =0x1            [VS]
 >>7    byte&0x0C       =0x8
 # NES 2.0: VS PPU
 >>>13  byte&0x0F       =0x0            \b, RP2C03B
@@ -43,17 +45,24 @@
 >>12   byte&0x03       =0x1            [PAL]
 >>12   byte&0x02       =0x2            [NTSC+PAL]
 
+# Standard iNES ROM header.
+0      string          NES\x1A         NES ROM image (iNES)
+>0     use             nes-rom-image-ines
+
+# Wii U Virtual Console iNES ROM header.
+0      belong          0x4E455300      NES ROM image (Wii U Virtual Console)
+>0     use             nes-rom-image-ines
+
 #------------------------------------------------------------------------------
 # unif: file(1) magic for UNIF-format Nintendo Entertainment System ROM images
 # Reference: http://wiki.nesdev.com/w/index.php/UNIF
 # From: David Korth <gerbils...@gerbilsoft.com>
-# TODO commit on 2016/03/21
 #
 # NOTE: The UNIF format uses chunks instead of a fixed header,
 # so most of the data isn't easily parseable.
 #
 0      string  UNIF
->4     lelong  <16     UNIF v%d format NES ROM image
+>4     lelong  <16     NES ROM image (UNIF v%d format)
 
 #------------------------------------------------------------------------------
 # fds: file(1) magic for Famciom Disk System disk images
@@ -63,25 +72,40 @@
 
 # Disk info block. (block 1)
 0      name    nintendo-fds-disk-info-block
->1     string  *NINTENDO-HVC*  Famicom Disk System disk image:
 >23    byte    !1              FMC-
 >23    byte    1               FSC-
 >16    string  x               \b%.3s
->15    byte    x               \b, mfr 0x%02X
+>15    byte    x               \b, mfr %02X
 >20    byte    x               (Rev.%02u)
 
 # Headered version.
 0      string  FDS\x1A
->0x11  string  *NINTENDO-HVC*
+>0x11  string  *NINTENDO-HVC*  Famicom Disk System disk image:
 >>0x10 use     nintendo-fds-disk-info-block
 >4     byte    1       (%u side)
 >4     byte    !1      (%u sides)
 
 # Unheadered version.
-1      string  *NINTENDO-HVC*
+1      string  *NINTENDO-HVC*  Famicom Disk System disk image:
 >0     use     nintendo-fds-disk-info-block
 
 #------------------------------------------------------------------------------
+# tnes: file(1) magic for TNES-format Nintendo Entertainment System ROM images
+# Used by Nintendo 3DS NES Virtual Console games.
+# From: David Korth <gerbils...@gerbilsoft.com>
+#
+0              string  TNES    NES ROM image (Nintendo 3DS Virtual Console)
+>4             byte    100     \b: FDS,
+>>0x2010       use     nintendo-fds-disk-info-block
+>4             byte    !100    \b: TNES mapper %u
+>>5    byte            x               \b, %ux8k PRG
+>>6    byte            x               \b, %ux8k CHR
+>>7    byte&0x08       =1              [WRAM]
+>>8    byte&0x09       =1              [H-mirror]
+>>8    byte&0x09       =2              [V-mirror]
+>>8    byte&0x02       =3              [VRAM]
+
+#------------------------------------------------------------------------------
 # gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format
 # Reference: http://gbdev.gg8.se/wiki/articles/The_Cartridge_Header
 #
@@ -491,6 +515,10 @@
 >3     byte            x       version %d,
 >4     byte            x       %d tracks
 
+# IPS Patch Files from: From: Thomas Klausner <t...@giga.or.at>
+# see http://zerosoft.zophar.net/ips.php
+0      string  PATCH                   IPS patch file
+
 # Playstations Patch Files from: From: Thomas Klausner <t...@giga.or.at>
 0      string  PPF30                   Playstation Patch File version 3.0
 >5     byte    0                       \b, PPF 1.0 patch
@@ -617,6 +645,52 @@
 >0x218 belong  0x5D1C9EA3      Nintendo Wii disc image (WBFS format):
 >>0x200        use     nintendo-gcn-disc-common
 
+# Type: Nintendo GameCube/Wii disc image (CISO format)
+# NOTE: This is NOT the same as Compact ISO or PSP CISO,
+# though it has the same magic number.
+0              string  CISO
+# Other fields are used to determine what type of CISO this is:
+# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size)
+# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size)
+# - None of the above: Compact ISO.
+>4             lelong  0x200000
+>>8            byte    1
+>>>0x801C      belong  0xC2339F3D      Nintendo GameCube disc image (CISO 
format):
+>>>>0x8000     use     nintendo-gcn-disc-common
+>>>0x8018      belong  0x5D1C9EA3      Nintendo Wii disc image (CISO format):
+>>>>0x8000     use     nintendo-gcn-disc-common
+
+# Type: Nintendo GameCube/Wii disc image (GCZ format)
+# Due to zlib compression, we can't get the actual disc information.
+0      lelong  0xB10BC001
+>4     lelong  0               Nintendo GameCube disc image (GCZ format)
+>4     lelong  1               Nintendo Wii disc image (GCZ format)
+>4     lelong  >1              Nintendo GameCube/Wii disc image (GCZ format)
+
+# Type: Nintendo GameCube/Wii disc image (WDF format)
+0              string  WII\001DISC
+>8             belong  1
+# WDFv1
+>>0x54         belong  0xC2339F3D      Nintendo GameCube disc image (WDFv1 
format):
+>>>0x38                use     nintendo-gcn-disc-common
+>>0x58         belong  0x5D1C9EA3      Nintendo Wii disc image (WDFv1 format):
+>>>0x38                use     nintendo-gcn-disc-common
+>8             belong  2
+# WDFv2
+>>(12.L+0x1C)  belong  0xC2339F3D      Nintendo GameCube disc image (WDFv2 
format):
+>>>(12.L)      use     nintendo-gcn-disc-common
+>>(12.L+0x18)  belong  0x5D1C9EA3      Nintendo Wii disc image (WDFv2 format):
+>>>(12.L)      use     nintendo-gcn-disc-common
+
+# Type: Nintendo GameCube/Wii disc image (WIA format)
+0      string  WIA\001 Nintendo
+>0x48  belong  0       GameCube/Wii
+>0x48  belong  1       GameCube
+>0x48  belong  2       Wii
+>0x48  belong  >2      GameCube/Wii
+>0x48  belong  x       disc image (WIA format):
+>>0x58 use     nintendo-gcn-disc-common
+
 #------------------------------------------------------------------------------
 # Nintendo 3DS file formats.
 #
@@ -750,3 +824,17 @@
 #
 0      string  g\ GCE  Vectrex ROM image
 >0x11  string  >\0     \b: "%.16s"
+
+#------------------------------------------------------------------------------
+# amiibo: file(1) magic for Nintendo amiibo NFC dumps.
+# From: David Korth <gerbils...@gerbilsoft.com>
+# Reference: https://www.3dbrew.org/wiki/Amiibo
+0x00           byte    0x04
+>0x0A          beshort 0x0FE0
+>>0x0C         belong  0xF110FFEE
+>>>0x208       beshort 0x0100
+>>>>0x020A     byte    0x0F
+>>>>>0x020C    bequad  0x000000045F000000
+>>>>>>0x5B     byte    0x02
+>>>>>>>0x54    belong  x       Nintendo amiibo NFC dump - amiibo ID: %08X-
+>>>>>>>0x58    belong  x       \b%08X
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/filesystems new/file-5.30/magic/Magdir/filesystems
--- old/file-5.29/magic/Magdir/filesystems      2016-09-05 10:34:25.000000000 
+0200
+++ new/file-5.30/magic/Magdir/filesystems      2017-01-03 12:25:37.000000000 
+0100
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: filesystems,v 1.114 2016/09/05 08:34:25 christos Exp $
+# $File: filesystems,v 1.116 2017/01/03 11:25:37 christos Exp $
 # filesystems:  file(1) magic for different filesystems
 #
 0      name    partid  
@@ -1949,7 +1949,19 @@
 >0     use cdrom
 
 # .cso files
-0    string    CISO    Compressed ISO CD image
+# Reference: http://pismotec.com/ciso/ciso.h
+# NOTE: There are two other formats with the same magic but
+# completely incompatible specifications:
+# - GameCube/Wii CISO: 
https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/DiscIO/CISOBlob.h
+# - PSP CISO: https://github.com/jamie/ciso/blob/master/ciso.h
+0    string    CISO
+# Other fields are used to determine what type of CISO this is:
+# - 0x04 == 0x00200000: GameCube/Wii CISO (block_size)
+# - 0x10 == 0x00000800: PSP CISO (ISO-9660 sector size)
+# - None of the above: Compact ISO.
+>4     lelong  !0
+>>4    lelong  !0x200000
+>>>0x10        lelong  !0x800          Compressed ISO CD image
 
 # cramfs filesystem - russ...@coker.com.au
 0       lelong    0x28cd3d45      Linux Compressed ROM File System data, 
little endian
@@ -2041,6 +2053,13 @@
 >29    byte    16              \bBlackfin,
 >29    byte    17              \bAVR32,
 >29    byte    18              \bSTMicroelectronics ST200,
+>29    byte    19              \bSandbox architecture,
+>29    byte    20              \bANDES Technology NDS32,
+>29    byte    21              \bOpenRISC 1000,
+>29    byte    22              \bARM 64-bit,
+>29    byte    23              \bDesignWare ARC,
+>29    byte    24              \bx86_64,
+>29    byte    25              \bXtensa,
 >30    byte    0               Invalid Image
 >30    byte    1               Standalone Program
 >30    byte    2               OS Kernel Image
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/flash new/file-5.30/magic/Magdir/flash
--- old/file-5.29/magic/Magdir/flash    2014-09-11 17:03:07.000000000 +0200
+++ new/file-5.30/magic/Magdir/flash    2017-02-08 00:25:26.000000000 +0100
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: flash,v 1.11 2014/05/02 00:26:49 christos Exp $
+# $File: flash,v 1.12 2017/02/07 23:25:26 christos Exp $
 # flash:       file(1) magic for Macromedia Flash file format
 #
 # See
@@ -11,22 +11,44 @@
 #
 
 0   name        swf-details
->0     string          F               Macromedia Flash data
-!:mime application/x-shockwave-flash
->0     string          C               Macromedia Flash data (compressed)
-!:mime application/x-shockwave-flash
->0     string          Z               Macromedia Flash data (lzma compressed)
-!:mime application/x-shockwave-flash
->3   byte        x      \b, version %d
+
+>0      string      F
+>>8     byte&0xfd   0x08    Macromedia Flash data
+!:mime  application/x-shockwave-flash
+>>>3    byte        x       \b, version %d
+>>8     byte&0xfe   0x10    Macromedia Flash data
+!:mime  application/x-shockwave-flash
+>>>3    byte        x       \b, version %d
+>>8     byte        0x18    Macromedia Flash data
+!:mime  application/x-shockwave-flash
+>>>3    byte        x       \b, version %d
+>>8     beshort&ff87 0x2000 Macromedia Flash data
+!:mime  application/x-shockwave-flash
+>>>3    byte        x       \b, version %d
+>>8     beshort&ffe0 0x3000 Macromedia Flash data
+!:mime  application/x-shockwave-flash
+>>>3    byte        x       \b, version %d
+>>8     byte&0x7    0
+>>>8    ubyte       >0x2f
+>>>>9   ubyte       <0x20   Macromedia Flash data
+!:mime  application/x-shockwave-flash
+>>>>>3  byte        x       \b, version %d
+
+>0      string      C
+>>8     byte        0x78    Macromedia Flash data (compressed)
+!:mime  application/x-shockwave-flash
+>>>3    byte        x       \b, version %d
+
+>0      string      Z
+>>8     byte        0x5d    Macromedia Flash data (lzma compressed)
+!:mime  application/x-shockwave-flash
+>>>3    byte        x      \b, version %d
+
 
 1   string      WS
->4  lelong      !0
->>3 byte        255 Suspicious
->>>0    use     swf-details
-
->>3 ubyte       <32
->>>3 ubyte      !0
->>>>0   use     swf-details
+>4  ulelong     >14
+>>3 ubyte       !0
+>>>0   use      swf-details
 
 # From: Cal Peake <c...@absolutedigital.net>
 0      string          FLV\x01         Macromedia Flash Video
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/fonts new/file-5.30/magic/Magdir/fonts
--- old/file-5.29/magic/Magdir/fonts    2016-09-14 03:26:26.000000000 +0200
+++ new/file-5.30/magic/Magdir/fonts    2016-12-01 16:30:33.000000000 +0100
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: fonts,v 1.33 2016/09/14 01:26:26 christos Exp $
+# $File: fonts,v 1.34 2016/12/01 15:30:33 christos Exp $
 # fonts:  file(1) magic for font data
 #
 0      search/1        FONT            ASCII vfont text
@@ -100,9 +100,11 @@
 
 # X11 fonts, from Daniel Quinlan (quin...@yggdrasil.com)
 # PCF must come before SGI additions ("MIPSEL MIPS-II COFF" collides)
-0      string          \001fcp                 X11 Portable Compiled Font data
->12    byte            0x02                    \b, LSB first
->12    byte            0x0a                    \b, MSB first
+0      string          \001fcp                 X11 Portable Compiled Font data,
+>12    lelong          ^0x08                   bit: LSB,
+>12    lelong          &0x08                   bit: MSB,
+>12    lelong          ^0x04                   byte: LSB first
+>12    lelong          &0x04                   byte: MSB first
 0      string          D1.0\015                X11 Speedo font data
 
 #------------------------------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/gpu new/file-5.30/magic/Magdir/gpu
--- old/file-5.29/magic/Magdir/gpu      1970-01-01 01:00:00.000000000 +0100
+++ new/file-5.30/magic/Magdir/gpu      2016-11-09 19:20:53.000000000 +0100
@@ -0,0 +1,16 @@
+
+#------------------------------------------------------------------------------
+# $File: gpu,v 1.1 2016/11/09 18:20:53 christos Exp $
+# gpu: file(1) magic for GPU input files
+
+# Standard Portable Intermediate Representation (SPIR)
+# Documentation: https://www.khronos.org/spir
+# Typical file extension: .spv
+
+0      belong  0x07230203      Khronos SPIR-V binary, big-endian
+>4     belong  x               \b, version 0x%08x
+>8     belong  x               \b, generator 0x%08x
+
+0      lelong  0x07230203      Khronos SPIR-V binary, little-endian
+>4     lelong  x               \b, version 0x%08x
+>8     lelong  x               \b, generator 0x%08x
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/icc new/file-5.30/magic/Magdir/icc
--- old/file-5.29/magic/Magdir/icc      2014-09-11 17:03:07.000000000 +0200
+++ new/file-5.30/magic/Magdir/icc      2016-12-02 20:32:15.000000000 +0100
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: icc,v 1.1 2013/01/08 01:43:18 christos Exp $
+# $File: icc,v 1.2 2016/12/02 19:32:15 christos Exp $
 # icc:  file(1) magic for International Color Consortium file formats
 
 #
@@ -11,41 +11,204 @@
 #      http://www.color.org/specification/ICC1v43_2010-12.pdf
 #
 # for Specification ICC.1:2010 (Profile version 4.3.0.0).
+# URL: http://fileformats.archiveteam.org/wiki/ICC_profile
+# Reference: http://www.color.org/iccmax/ICC.2-2016-7.pdf
+# Update: Joerg Jenderek
 #
 # Bytes 36 to 39 contain a generic profile file signature of "acsp";
 # bytes 40 to 43 "may be used to identify the primary platform/operating
 # system framework for which the profile was created".
 #
-# There are other fields that might be worth dumping as well.
-#
+#      check and display ICC/ICM color profile
+0      name    color-profile
+>36    string          acsp            
+# skip ASCII like Cognacspirit.txt by month <= 12
+>>26   ubeshort        <13             
+# platform/operating system. Only 5 mentioned
 
+#
 # This appears to be what's used for Apple ColorSync profiles.
 # Instead of adding that, Apple just changed the generic "acsp" entry
 # to be for "ColorSync ICC Color Profile" rather than "Kodak Color
 # Management System, ICC Profile".
 # Yes, it's "APPL", not "AAPL"; see the spec.
-36     string          acspAPPL        ColorSync ICC Profile
-!:mime application/vnd.iccprofile
+>>>40  string          APPL            ColorSync
 
 # Microsoft ICM color profile
-36     string          acspMSFT        Microsoft ICM Color Profile
-!:mime application/vnd.iccprofile
+>>>40  string          MSFT            Microsoft
 
 # Yes, that's a blank after "SGI".
-36     string          acspSGI\        SGI ICC Profile
-!:mime application/vnd.iccprofile
+>>>40  string          SGI\            SGI
 
 # XXX - is this what's used for the Sun KCMS or not?  The standard file
 # uses just "acsp" for that, but Apple's file uses it for "ColorSync",
 # and there *is* an identified "primary platform" value of SUNW.
-36     string          acspSUNW        Sun KCMS ICC Profile
+>>>40  string          SUNW            Sun KCMS
+
+# 5th platform
+>>>40  string          TGNT            Taligent
+
+# remaing "l" "e" of "color profile" printed later to avoid error
+>>>40  string          x               color profi
+#>>>40 string          x               (%.4s)
 !:mime application/vnd.iccprofile
+# for "ICM" extension only versions 2.x and for Kodak "CC" 2.0 is found
+>>>8   ubyte           =2              
+# do not use empty message text to a avoid error like
+# icc, 82: Warning: Current entry does not yet have a description for adding a 
EXTENSION type
+# file.exe: could not find any valid magic files!
+>>>>9  ubyte           !0              \ble
+!:ext  icc/icm
+# minor version
+>>>>9  ubyte           =0              \bl
+# Kodak colour management system
+>>>>>4 string          =KCMS           \be
+!:ext  icc/icm/cc
+>>>>>4 string          !KCMS           \be
+!:ext  icc/icm
+>>>8   ubyte           !2              \ble
+!:ext  icc
+# Profile version major.4bit-minor.sub1.sub2 like 4.3.0.0 (04300000h)
+>>>8   ubyte           x               %u
+>>>9   ubyte/16        x               \b.%u
+# reserved and shall be null but 205.205 in umx1220u.icm
+>>>10  ubyte           >0              \b.%u
+>>>>11 ubyte           >0              \b.%u
+# preferred colour management module like appl CCMS KCMS Lino UCCM "Win " "FF  
"
+# skip space like in brmsl08f.icm and null like in brmsl09f.icm, brmsl07f.icm
+>>>4   string          >\              \b, type %.2s
+>>>>6  string          >\              \b%.1s
+>>>>>7 string          >\              \b%.1s
+# colour space "XYZ " "Lab " "RGB " CMYK GRAY ...
+>>>16  string          x               \b, %.3s
+>>>19  string          >\              \b%.1s
+# Profile Connection Space (PCS) field usually "XYZ " or "Lab " but sometimes
+# null or CMYK like in ISOcoated_v2_to_PSOcoated_v3_DeviceLink.icc
+>>>20  string          >\0             \b/%.3s
+>>>>23 string          >\              \b%.1s
+# eleven device classes
+>>>12  string          x               \b-%.4s device
+# skip 00001964h in hpf69000.icc or 0h in XRDC50Q.ICM or " ROT" in brmsl05f.icm
+>>>52  string          >\              
+# skip "none" model like in "Trinitron Compatible 9300K G2.2.icm"
+>>>>52 ubelong         !0x6e6f6e65     
+# device manufacturer field like "HP  " "IBM " EPSO
+>>>>>48        string          x               \b, %.2s
+>>>>>50        string          >\              \b%.1s
+>>>>>51        string          >\              \b%.1s
+# model like "ADI " "A265" and skip 20000404h in IS330.icm for RICOH RUSSIAN-SC
+>>>>>52        string          >\ \            \b/%.3s
+>>>>>>55 string                >\              \b%.1s
+>>>>>52        string          x               model
+# creator (often same as manufacture) like HP SONY XROX or null like in 
A925A.icm
+>>>80  string          >\0             by %.2s
+>>>>82 string          >\              \b%.1s
+>>>>>83        string          >\              \b%.1s
+# profile size
+>>>0   ubelong         x               \b, %u bytes
+# skip invalid date 0 like in linearSRGB.icc
+>>>24  ubequad         !0              
+# datetime dd-mm-yyyy hh:mm:ss
+>>>>28 ubeshort        x               \b, %u
+# month <= 12
+>>>>26 ubeshort        x               \b-%u
+# year
+>>>>24 ubeshort        x               \b-%u
+# do not display midnight time like in CNHP8308.ICC
+>>>>30 ubequad&0xFFffFFffFFff0000      !0
+# hour <= 24
+>>>>>30        ubeshort        x               %u
+# minutes <= 59
+>>>>>32        ubeshort        x               \b:%.2u
+# seconds <= 59
+>>>>>34        ubeshort        x               \b:%.2u
+# vendor specific flags like 2 in HPCLJ5.ICM
+>>>44  ubeshort        >0              \b, 0x%x vendor flags
+# profile flags bits 0-2 of least 16 used by ICC
+#>>>44 ubelong         >0              \b, 0x%x flags
+# icEmbeddedProfileTrue
+>>>44  ubelong         &1              \b, embedded
+# icEmbeddedProfileFalse
+#>>>44 ubelong         ^1              \b, not embedded
+# icUseWithEmbeddedDataOnly
+>>>44  ubelong         &2              \b, dependently
+# icUseAnywhere
+#>>>44 ubelong         ^2              \b, independently
+>>>44  ubelong         &4              \b, MCS
+#>>>44 ubelong         ^4              \b, no MCS
+# vendor specific device attributes 1~srgb.icc
+# E000D00h~CNB7QEDA.ICM C000A00h~CNB5FCAA.ICM 01040401h~CNB25PE3.ICM
+>>>56  ubelong         >0              \b, 0x%x vendor attribute
+# ICC device attributes bits 0-7 used
+#>>>60 ubelong         x               \b, 0x%x attribute
+# http://www.color.org/icc34.h
+>>>60  ubelong         &0x01           \b, transparent
+#>>>60 ubelong         ^0x01           \b, reflective
+>>>60  ubelong         &0x02           \b, matte
+#>>>60 ubelong         ^0x02           \b, glossy
+>>>60  ubelong         &0x04           \b, negative
+#>>>60 ubelong         ^0x04           \b, positive
+>>>60  ubelong         &0x08           \b, black&white
+#>>>60 ubelong         ^0x08           \b, colour
+>>>60  ubelong         &0x10           \b, non-paper
+#>>>60 ubelong         ^0x10           \b, paper
+>>>60  ubelong         &0x20           \b, non-textured
+#>>>60 ubelong         ^0x20           \b, textured
+>>>60  ubelong         &0x40           \b, non-isotropic
+#>>>60 ubelong         ^0x40           \b, isotropic
+>>>60  ubelong         &0x80           \b, self-luminous
+#>>>60 ubelong         ^0x80           \b, non-self-luminous
+# rendering intent 0-3 but 7AEA5027h in EE051__1.ICM 6CB1BCh in EE061__1.ICM
+>>>64  ubelong         >3              \b, 0x%x rendering intent
+#>>>64 ubelong         =0              \b, perceptual
+>>>64  ubelong         =1              \b, relative colorimetric
+>>>64  ubelong         =2              \b, saturation
+>>>64  ubelong         =3              \b, absolute colorimetric
+# PCS illuminant (3*s15Fixed16Numbers) often 0000f6d6 00010000 0000d32d
+>>>71  ubequad         !0xd6000100000000d3     \b, PCS
+# usually X~0.9642*65536=63189.8112~63190=F6D5h ; but also found
+# often F6D6 in gt5000r.icm, F6B8 in kodakce.icm, F6CA in RSWOP.icm
+>>>>68 ubelong                 !0x0000f6d5     X=0x%x
+# usually Y=1.0~00010000h but Y=0 in brmsl07f.icm
+>>>>72 ubelong                 !0x00010000     Y=0x%x
+# usually Z~0.8249*65536=54060.6464~54061=D32Dh ; but also found
+# D2F7 in hp1200c.icm, often D32C in A925A.icm, D309 in RSWOP.icm , D2F8 in 
kodak_dc.icm
+>>>>76 ubelong                 !0x0000d32d     Z=0x%x
+# Profile ID. MD5 fingerprinting method as defined in Internet RFC 1321.
+>>>84  ubequad         >0              \b, 0x%llx MD5
+# reserved in older versions should be zero but also found CDCDCDCDCDCDCDCD
+#>>100 ubequad         x               \b 0x%llx reserved
+# tag table
+# 6 <= tags count <= 43
+#>>>128        ubelong         >43             \b, %u tags
+>>>128 ubelong         x               
+# shall contain the profileDescriptionTag "desc" , copyrightTag "cprt"
+# search range = tags count * 12 -8=< maximal tag count * 12 -8= 43 * 12 -8= 
508
+>>>>132        search/508      cprt            
+# but no copyright tag in linearSRGB.icc
+# beneath /System/Library/Frameworks/WebKit.framework/
+# Versions/A/Frameworks/WebCore.framework/Versions/A/Resources
+>>>>132        default         x               \b, no copyright tag
+# 1st tag
+#>>>132        string          x               \b, 1st tag %.4s
+#>>>136        ubelong         x               0x%x offset
+#>>>140        ubelong         x               0x%x len
+# 2nd tag,...
+# look also for profileDescriptionTag "desc"
+>>>132 search/508      desc            
+# look further for TextDescriptionType "desc" signature
+>>>>(&0.L)     string          =desc   
+>>>>>&4                pstring/l       x       "%s"
+# look alternative for multiLocalizedUnicodeType "mluc" signature like in 
VideoPAL.icc
+>>>>(&0.L)     string          =mluc   
+>>>>>&(&8.L)   ubequad         x               
+>>>>>>&4       bestring16      x       '%s'
 
 # Any other profile.
 # XXX - should we use "acsp\0\0\0\0" for "no primary platform" profiles,
 # and use "acsp" for everything else and dump the "primary platform"
 # string in those cases?
-36     string          acsp            ICC Profile
-!:mime application/vnd.iccprofile
+36     string          acsp            
+>0     use             color-profile
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/images new/file-5.30/magic/Magdir/images
--- old/file-5.29/magic/Magdir/images   2016-07-05 21:12:21.000000000 +0200
+++ new/file-5.30/magic/Magdir/images   2016-12-01 17:20:13.000000000 +0100
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: images,v 1.117 2016/07/05 19:12:21 christos Exp $
+# $File: images,v 1.121 2016/12/01 16:20:13 christos Exp $
 # images:  file(1) magic for image formats (see also "iff", and "c-lang" for
 # XPM bitmaps)
 #
@@ -41,7 +41,11 @@
 >>>>>>3        uleshort                0       
 >>>>>>>0       use             tga-image
 # Color Map
->>>>>1 ubyte                   >0      
+>>>>>1 belong&0xfff7ffff       0x01010000
+>>>>>>0                use             tga-image
+>>>>>1 belong&0xfff7ffff       0x00020000
+>>>>>>0                use             tga-image
+>>>>>1 belong&0xfff7ffff       0x00030000
 >>>>>>0                use             tga-image
 #      display tga bitmap image information
 0      name                            tga-image
@@ -418,6 +422,7 @@
 #
 0      string          \x89PNG\x0d\x0a\x1a\x0a         PNG image data
 !:mime image/png
+!:strength +10
 >16    belong          x               \b, %d x
 >20    belong          x               %d,
 >24    byte            x               %d-bit
@@ -1451,3 +1456,12 @@
 >0x10  string  GVRT    Sega GVR image:
 >>0x10 use     sega-gvr-image-header
 >>0x08 belong  x       \b, global index = %u
+
+# Light Field Picture
+# Documentation: http://optics.miloush.net/lytro/TheFileFormat.aspx
+# Typical file extensions: .lfp .lfr .lfx
+
+0      belong  0x894C4650
+>4     belong  0x0D0A1A0A
+>12    belong  0x00000000      Lytro Light Field Picture
+>8     belong  x               \b, version %d
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/make new/file-5.30/magic/Magdir/make
--- old/file-5.29/magic/Magdir/make     2015-08-25 09:34:06.000000000 +0200
+++ new/file-5.30/magic/Magdir/make     2016-12-10 15:21:29.000000000 +0100
@@ -1,7 +1,8 @@
 #------------------------------------------------------------------------------
-# $File: make,v 1.2 2015/08/25 07:34:06 christos Exp $
+# $File: make,v 1.3 2016/12/10 14:21:29 christos Exp $
 # make:  file(1) magic for makefiles
 #
+# URL: https://en.wikipedia.org/wiki/Make_(software)
 0      regex/100l      \^CFLAGS        makefile script text
 !:mime text/x-makefile
 0      regex/100l      \^VPATH         makefile script text
@@ -10,12 +11,19 @@
 !:mime text/x-makefile
 0      regex/100l      \^all:          makefile script text
 !:mime text/x-makefile
-0      regex/100l      \^\.PRECIOUS    makefile script text
+0      regex/100l      \^\\.PRECIOUS   makefile script text
 !:mime text/x-makefile
-0      regex/100l      \^\.BEGIN       BSD makefile script text
+# Update: Joerg Jenderek
+# Reference: https://www.freebsd.org/cgi/man.cgi?make(1)
+# exclude grub-core\lib\libgcrypt\mpi\Makefile.am with "#BEGIN_ASM_LIST"
+# by additional escaping point character
+0      regex/100l      \^\\.BEGIN      BSD makefile script text with "%s"
+!:mime text/x-makefile
+!:ext  /mk
+# exclude MS Windows help file CoNtenT with ":include FOOBAR.CNT"
+# and NSIS script with "!include" by additional escaping point character
+0      regex/100l      \^\\.include    BSD makefile script text with "%s"
 !:mime text/x-makefile
-0      regex/100l      \^\.include     BSD makefile script text
-!:mime text/x-makefile
-
+!:ext  /mk
 0      regex/100l      \^SUBDIRS       automake makefile script text
 !:mime text/x-makefile
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/msdos new/file-5.30/magic/Magdir/msdos
--- old/file-5.29/magic/Magdir/msdos    2016-09-14 03:26:26.000000000 +0200
+++ new/file-5.30/magic/Magdir/msdos    2017-01-18 17:24:56.000000000 +0100
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: msdos,v 1.111 2016/09/14 01:26:26 christos Exp $
+# $File: msdos,v 1.115 2017/01/18 16:24:56 christos Exp $
 # msdos:  file(1) magic for MS-DOS files
 #
 
@@ -565,10 +565,23 @@
 0      string/b        PO^Q`                           Microsoft Word 6.0 
Document
 !:mime application/msword
 #
-0      string/b        \376\067\0\043                  Microsoft Office 
Document
+4   long        0
+>0  belong      0xfe320000      Microsoft Word for Macintosh 1.0
 !:mime application/msword
-0      string/b        \333\245-\0\0\0                 Microsoft Office 
Document
+!:ext   mcw
+>0  belong      0xfe340000      Microsoft Word for Macintosh 3.0
 !:mime application/msword
+!:ext   mcw
+>0  belong      0xfe37001c      Microsoft Word for Macintosh 4.0
+!:mime application/msword
+!:ext   mcw
+>0  belong      0xfe370023      Microsoft Word for Macintosh 5.0
+!:mime application/msword
+!:ext   mcw
+
+0      string/b        \333\245-\0\0\0                 Microsoft Word 2.0 
Document
+!:mime application/msword
+!:ext   doc
 512    string/b        \354\245\301                    Microsoft Word Document
 !:mime application/msword
 
@@ -960,6 +973,7 @@
 # DOS EPS Binary File Header
 # From: Ed Sznyter <e...@black.market.net>
 0      belong          0xC5D0D3C6      DOS EPS Binary File
+!:mime image/x-eps
 >4     long            >0              Postscript starts at byte %d
 >>8    long            >0              length %d
 >>>12  long            >0              Metafile starts at byte %d
@@ -1106,3 +1120,40 @@
 0      string  MIOPEN          Mallard BASIC Jetsam data
 0      string  Jetsam0         Mallard BASIC Jetsam index data
 
+# DOS backup 2.0 to 3.2
+
+# backupid.@@@
+
+# plausibility check for date
+0x3    ushort  >1979
+>0x5   ubyte-1 <31
+>>0x6  ubyte-1 <12
+# actually 121 nul bytes
+>>>0x7 string  \0\0\0\0\0\0\0\0
+>>>>0x1 ubyte  x       DOS 2.0 backup id file, sequence %d
+!:ext @@@
+>>>>0x0 ubyte  0xff    \b, last disk
+
+# backed up file
+
+# plausibility check for file name length
+0x53   ubyte-1 <80
+# actually 54 nul bytes
+>0x54  string  \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
+>>0x5  string  x       DOS 2.0 backed up file %s,
+>>0    ubyte   0xff    complete file
+>>0    ubyte   !0xff
+>>>1   ushort  x       split file, sequence %d
+
+
+# DOS backup 3.3 to 5.x
+
+# CONTROL.nnn files
+0      string  \x8bBACKUP\x20
+# actually 128 nul bytes
+>0xa   string  \0\0\0\0\0\0\0\0
+>>0x9  ubyte   x       DOS 3.3 backup control file, sequence %d
+>>0x8a ubyte   0xff    \b, last disk
+
+# NB: The BACKUP.nnn files consist of the files backed up,
+# concatenated.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/msx new/file-5.30/magic/Magdir/msx
--- old/file-5.29/magic/Magdir/msx      2016-06-13 21:09:14.000000000 +0200
+++ new/file-5.30/magic/Magdir/msx      2016-10-31 22:12:14.000000000 +0100
@@ -245,18 +245,18 @@
 0x4000 string/b                AB
 >0x4002        uleshort        >0x400F
 >>0x400A       string          \0\0\0\0\0\0    MSX ROM with nonstandard page 
 >>order
->>0x4002       uleshort        x                       \b, init=0x%04x
->>0x4004       uleshort        >0                      \b, stahdl=0x%04x
->>0x4006       uleshort        >0                      \b, devhdl=0x%04x
->>0x4008       uleshort        >0                      \b, bas=0x%04x
+>>>0x4002      uleshort        x                       \b, init=0x%04x
+>>>0x4004      uleshort        >0                      \b, stahdl=0x%04x
+>>>0x4006      uleshort        >0                      \b, devhdl=0x%04x
+>>>0x4008      uleshort        >0                      \b, bas=0x%04x
 
 0x8000 string/b                AB
 >0x8002        uleshort        >0x400F
 >>0x800A       string          \0\0\0\0\0\0    MSX ROM with nonstandard page 
 >>order
->>0x8002       uleshort        x                       \b, init=0x%04x
->>0x8004       uleshort        >0                      \b, stahdl=0x%04x
->>0x8006       uleshort        >0                      \b, devhdl=0x%04x
->>0x8008       uleshort        >0                      \b, bas=0x%04x
+>>>0x8002      uleshort        x                       \b, init=0x%04x
+>>>0x8004      uleshort        >0                      \b, stahdl=0x%04x
+>>>0x8006      uleshort        >0                      \b, devhdl=0x%04x
+>>>0x8008      uleshort        >0                      \b, bas=0x%04x
 
 
 0x3C000        string/b                AB
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/pbf new/file-5.30/magic/Magdir/pbf
--- old/file-5.29/magic/Magdir/pbf      2014-09-11 17:03:07.000000000 +0200
+++ new/file-5.30/magic/Magdir/pbf      2017-01-18 17:16:21.000000000 +0100
@@ -1,11 +1,11 @@
 
 #------------------------------------------------------------------------------
-# $File: pbf,v 1.1 2013/12/21 14:27:24 christos Exp $
+# $File: pbf,v 1.2 2017/01/18 16:16:21 christos Exp $
 # file(1) magic(5) data for OpenStreetMap
 
 # OpenStreetMap Protocolbuffer Binary Format (.osm.pbf)
 # http://wiki.openstreetmap.org/wiki/PBF_Format
 # From: Markus Heidelberg <markus.heidelb...@web.de>
-0      belong          0x0000000D
->4     beshort         0x0A09
->>6    string          OSMHeader       OpenStreetMap Protocolbuffer Binary 
Format
+0      belong&0xfffffff0       0
+>4     beshort                 0x0A09
+>>6    string                  OSMHeader       OpenStreetMap Protocolbuffer 
Binary Format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/pgp new/file-5.30/magic/Magdir/pgp
--- old/file-5.29/magic/Magdir/pgp      2016-10-07 22:22:12.000000000 +0200
+++ new/file-5.30/magic/Magdir/pgp      2017-01-22 22:13:13.000000000 +0100
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: pgp,v 1.12 2016/10/07 20:22:12 christos Exp $
+# $File: pgp,v 1.13 2017/01/22 21:13:13 christos Exp $
 # pgp:  file(1) magic for Pretty Good Privacy
 # see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
 #
@@ -19,15 +19,15 @@
 #>15   string  SIGNED\040MESSAGE-      signed message
 #>15   string  PGP\040SIGNATURE-       signature
 
-2      string  ---BEGIN\ PGP\ PUBLIC\ KEY\ BLOCK-      PGP public key block
+2      string  ---BEGIN\040PGP\040PUBLIC\040KEY\040BLOCK-      PGP public key 
block
 !:mime application/pgp-keys
 >10    search/100      \n\n
 >>&0   use             pgp
-0      string  -----BEGIN\040PGP\40MESSAGE-            PGP message
+0      string  -----BEGIN\040PGP\040MESSAGE-           PGP message
 !:mime application/pgp
 >10    search/100      \n\n
 >>&0   use             pgp
-0      string  -----BEGIN\040PGP\40SIGNATURE-          PGP signature
+0      string  -----BEGIN\040PGP\040SIGNATURE-         PGP signature
 !:mime application/pgp-signature
 >10    search/100      \n\n
 >>&0   use             pgp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/sgml new/file-5.30/magic/Magdir/sgml
--- old/file-5.29/magic/Magdir/sgml     2016-09-11 15:56:42.000000000 +0200
+++ new/file-5.30/magic/Magdir/sgml     2016-12-01 16:40:52.000000000 +0100
@@ -1,4 +1,6 @@
-#------------------------------------------------------------------------------
 # $File: sgml,v 1.34 2016/09/11 13:56:42 christos Exp $
+
+#------------------------------------------------------------------------------
+# $File: sgml,v 1.36 2016/12/01 15:40:52 christos Exp $
 # Type:        SVG Vectorial Graphics
 # From:        Noel Torres <tecn...@ejerciciosresueltos.com>
 0      string          \<?xml\ version="
@@ -46,6 +48,12 @@
 !:mime text/html
 !:strength + 5
 
+# SVG document
+# https://www.w3.org/TR/SVG/single-page.html
+0      search/4096/cWbt        \<!doctype\ svg SVG XML document
+!:mime  image/svg+xml
+!:strength + 5
+
 0      search/4096/cwt \<head\>                HTML document text
 !:mime text/html
 !:strength + 5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/ssl new/file-5.30/magic/Magdir/ssl
--- old/file-5.29/magic/Magdir/ssl      2014-09-11 17:03:07.000000000 +0200
+++ new/file-5.30/magic/Magdir/ssl      2017-01-22 22:14:25.000000000 +0100
@@ -1,8 +1,20 @@
+
+#------------------------------------------------------------------------------
+# $File: ssl,v 1.4 2017/01/22 21:14:25 christos Exp $
+# ssl:  file(1) magic for SSL file formats
+
 # Type: OpenSSL certificates/key files
 # From: Nicolas Collignon <tsoints...@gmail.com>
 
-0      string  -----BEGIN\ CERTIFICATE-----    PEM certificate
-0      string  -----BEGIN\ CERTIFICATE\ REQ    PEM certificate request
-0      string  -----BEGIN\ RSA\ PRIVATE        PEM RSA private key
-0      string  -----BEGIN\ DSA\ PRIVATE        PEM DSA private key
-0      string  -----BEGIN\ EC\ PRIVATE PEM EC private key
+0      string  -----BEGIN\040CERTIFICATE-----  PEM certificate
+0      string  -----BEGIN\040CERTIFICATE\040REQ        PEM certificate request
+0      string  -----BEGIN\040RSA\040PRIVATE    PEM RSA private key
+0      string  -----BEGIN\040DSA\040PRIVATE    PEM DSA private key
+0      string  -----BEGIN\040EC\040PRIVATE     PEM EC private key
+0      string  -----BEGIN\040ECDSA\040PRIVATE  PEM ECDSA private key
+
+# From Luc Gommans
+# OpenSSL enc file (recognized by a magic string preceding the password's salt)
+0      string  Salted__        openssl enc'd data with salted password
+# Using the -a or -base64 option, OpenSSL will base64-encode the data.
+0      string U2FsdGVkX19      openssl enc'd data with salted password, base64 
encoded
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Magdir/yara new/file-5.30/magic/Magdir/yara
--- old/file-5.29/magic/Magdir/yara     1970-01-01 01:00:00.000000000 +0100
+++ new/file-5.30/magic/Magdir/yara     2016-10-30 02:38:01.000000000 +0200
@@ -0,0 +1,17 @@
+
+
+#------------------------------------------------------------------------------
+# $File: yara,v 1.1 2016/10/30 00:38:01 christos Exp $
+# yara:  file(1) magic for http://virustotal.github.io/yara/
+#
+
+0      string  YARA
+>4     lelong  >2047
+>8     byte    <20     YARA 3.x compiled rule set
+# version
+>>8    clear
+>>8    byte    6       created with version 3.3.0
+>>8    byte    8       created with version 3.4.0
+>>8    byte    11      created with version 3.5.0
+>>8    default x
+>>>8   byte    x       development version 0x%02x
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/magic/Makefile.am new/file-5.30/magic/Makefile.am
--- old/file-5.29/magic/Makefile.am     2016-10-17 21:52:29.000000000 +0200
+++ new/file-5.30/magic/Makefile.am     2016-11-09 19:20:53.000000000 +0100
@@ -1,5 +1,5 @@
 #
-# $File: Makefile.am,v 1.120 2016/10/17 19:52:29 christos Exp $
+# $File: Makefile.am,v 1.122 2016/11/09 18:20:53 christos Exp $
 #
 MAGIC_FRAGMENT_BASE = Magdir
 MAGIC_DIR = $(top_srcdir)/magic
@@ -104,6 +104,7 @@
 $(MAGIC_FRAGMENT_DIR)/gnu \
 $(MAGIC_FRAGMENT_DIR)/gnumeric \
 $(MAGIC_FRAGMENT_DIR)/gpt \
+$(MAGIC_FRAGMENT_DIR)/gpu \
 $(MAGIC_FRAGMENT_DIR)/grace \
 $(MAGIC_FRAGMENT_DIR)/graphviz \
 $(MAGIC_FRAGMENT_DIR)/gringotts \
@@ -285,6 +286,7 @@
 $(MAGIC_FRAGMENT_DIR)/xilinx \
 $(MAGIC_FRAGMENT_DIR)/xo65 \
 $(MAGIC_FRAGMENT_DIR)/xwindows \
+$(MAGIC_FRAGMENT_DIR)/yara \
 $(MAGIC_FRAGMENT_DIR)/zfs \
 $(MAGIC_FRAGMENT_DIR)/zilog \
 $(MAGIC_FRAGMENT_DIR)/zyxel 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/src/apprentice.c new/file-5.30/src/apprentice.c
--- old/file-5.29/src/apprentice.c      2016-10-24 20:02:17.000000000 +0200
+++ new/file-5.30/src/apprentice.c      2017-02-07 23:45:01.000000000 +0100
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.255 2016/10/24 18:02:17 christos Exp 
$")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.257 2017/02/04 16:46:16 christos Exp 
$")
 #endif /* lint */
 
 #include "magic.h"
@@ -2291,7 +2291,7 @@
 
        return parse_extra(ms, me, line,
            CAST(off_t, offsetof(struct magic, ext)),
-           sizeof(m->ext), "EXTENSION", ",!+-/", 0);
+           sizeof(m->ext), "EXTENSION", ",!+-/@", 0);
 }
 
 /*
@@ -3271,22 +3271,35 @@
 {
        size_t len = 0;
        const unsigned char *s = (const unsigned char *)ss;
+       unsigned int s3, s2, s1, s0;
 
        switch (m->str_flags & PSTRING_LEN) {
        case PSTRING_1_LE:
                len = *s;
                break;
        case PSTRING_2_LE:
-               len = (s[1] << 8) | s[0];
+               s0 = s[0];
+               s1 = s[1];
+               len = (s1 << 8) | s0;
                break;
        case PSTRING_2_BE:
-               len = (s[0] << 8) | s[1];
+               s0 = s[0];
+               s1 = s[1];
+               len = (s0 << 8) | s1;
                break;
        case PSTRING_4_LE:
-               len = (s[3] << 24) | (s[2] << 16) | (s[1] << 8) | s[0];
+               s0 = s[0];
+               s1 = s[1];
+               s2 = s[2];
+               s3 = s[3];
+               len = (s3 << 24) | (s2 << 16) | (s1 << 8) | s0;
                break;
        case PSTRING_4_BE:
-               len = (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3];
+               s0 = s[0];
+               s1 = s[1];
+               s2 = s[2];
+               s3 = s[3];
+               len = (s0 << 24) | (s1 << 16) | (s2 << 8) | s3;
                break;
        default:
                abort();        /* Impossible */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/src/cdf.c new/file-5.30/src/cdf.c
--- old/file-5.29/src/cdf.c     2016-10-24 20:02:17.000000000 +0200
+++ new/file-5.30/src/cdf.c     2017-02-08 00:21:29.000000000 +0100
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: cdf.c,v 1.85 2016/10/24 18:02:17 christos Exp $")
+FILE_RCSID("@(#)$File: cdf.c,v 1.88 2017/02/07 23:21:29 christos Exp $")
 #endif
 
 #include <assert.h>
@@ -527,9 +527,12 @@
        ssize_t nr;
        scn->sst_tab = NULL;
        scn->sst_len = cdf_count_chain(sat, sid, ss);
-       scn->sst_dirlen = len;
+       scn->sst_dirlen = MAX(h->h_min_size_standard_stream, len);
        scn->sst_ss = ss;
 
+       if (sid == CDF_SECID_END_OF_CHAIN || len == 0)
+               return cdf_zero_stream(scn);
+
        if (scn->sst_len == (size_t)-1)
                goto out;
 
@@ -888,8 +891,8 @@
                        DPRINTF(("Wrapped around %p < %p\n", q, p));
                        goto out;
                }
-               if (q > e) {
-                       DPRINTF(("Ran of the end %p > %p\n", q, e));
+               if (q >= e) {
+                       DPRINTF(("Ran of the end %p >= %p\n", q, e));
                        goto out;
                }
                inp[i].pi_id = CDF_GETUINT32(p, i << 1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/src/compress.c new/file-5.30/src/compress.c
--- old/file-5.29/src/compress.c        2016-10-24 20:02:17.000000000 +0200
+++ new/file-5.30/src/compress.c        2017-01-18 17:33:57.000000000 +0100
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: compress.c,v 1.100 2016/10/24 18:02:17 christos Exp $")
+FILE_RCSID("@(#)$File: compress.c,v 1.101 2017/01/18 16:33:57 christos Exp $")
 #endif
 
 #include "magic.h"
@@ -62,7 +62,7 @@
 #if defined(HAVE_SYS_TIME_H)
 #include <sys/time.h>
 #endif
-#if defined(HAVE_ZLIB_H)
+#if defined(HAVE_ZLIB_H) && defined(ZLIBSUPPORT)
 #define BUILTIN_DECOMPRESS
 #include <zlib.h>
 #endif
@@ -83,6 +83,7 @@
 /*
  * The following python code is not really used because ZLIBSUPPORT is only
  * defined if we have a built-in zlib, and the built-in zlib handles that.
+ * That is not true for android where we have zlib.h and not -lz.
  */
 static const char zlibcode[] =
     "import sys, zlib; sys.stdout.write(zlib.decompress(sys.stdin.read()))";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/src/der.c new/file-5.30/src/der.c
--- old/file-5.29/src/der.c     2016-10-24 20:02:17.000000000 +0200
+++ new/file-5.30/src/der.c     2016-11-07 16:51:23.000000000 +0100
@@ -35,7 +35,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: der.c,v 1.10 2016/10/24 18:02:17 christos Exp $")
+FILE_RCSID("@(#)$File: der.c,v 1.11 2016/11/07 15:51:23 christos Exp $")
 #endif
 #endif
 
@@ -159,31 +159,49 @@
        return tag;
 }
 
+/*
+ * Read the length of a DER tag from the input.
+ *
+ * `c` is the input, `p` is an output parameter that specifies how much of the
+ * input we consumed, and `l` is the maximum input length.
+ *
+ * Returns the length, or DER_BAD if the end of the input is reached or the
+ * length exceeds the remaining input.
+ */
 static uint32_t
 getlength(const uint8_t *c, size_t *p, size_t l)
 {
        uint8_t digits, i;
        size_t len;
+       int is_onebyte_result;
 
        if (*p >= l)
                return DER_BAD;
 
-       digits = c[(*p)++];
+       /*
+        * Digits can either be 0b0 followed by the result, or 0b1
+        * followed by the number of digits of the result. In either case,
+        * we verify that we can read so many bytes from the input.
+        */
+       is_onebyte_result = (c[*p] & 0x80) == 0;
+       digits = c[(*p)++] & 0x7f;
+       if (*p + digits >= l)
+               return DER_BAD;
 
-        if ((digits & 0x80) == 0)
+       if (is_onebyte_result)
                return digits;
 
-        digits &= 0x7f;
+       /*
+        * Decode len. We've already verified that we're allowed to read
+        * `digits` bytes.
+        */
        len = 0;
-
-       if (*p + digits >= l)
-               return DER_BAD;
-
        for (i = 0; i < digits; i++)
                len = (len << 8) | c[(*p)++];
+
        if (*p + len >= l)
                return DER_BAD;
-        return len;
+       return len;
 }
 
 static const char *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/src/funcs.c new/file-5.30/src/funcs.c
--- old/file-5.29/src/funcs.c   2016-10-19 22:51:17.000000000 +0200
+++ new/file-5.30/src/funcs.c   2016-12-01 17:16:14.000000000 +0100
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.90 2016/10/19 20:51:17 christos Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.91 2016/12/01 16:16:14 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -76,7 +76,7 @@
        ms->o.buf = buf;
        return 0;
 out:
-       file_error(ms, errno, "vasprintf failed");
+       fprintf(stderr, "vasprintf failed (%s)", strerror(errno));
        return -1;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/src/readelf.c new/file-5.30/src/readelf.c
--- old/file-5.29/src/readelf.c 2016-10-04 23:43:10.000000000 +0200
+++ new/file-5.30/src/readelf.c 2017-02-01 13:36:59.000000000 +0100
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.128 2016/10/04 21:43:10 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.130 2017/01/29 19:34:24 christos Exp $")
 #endif
 
 #ifdef BUILTIN_ELF
@@ -1185,7 +1185,7 @@
 {
        Elf32_Shdr sh32;
        Elf64_Shdr sh64;
-       int stripped = 1;
+       int stripped = 1, has_debug_info = 1;
        size_t nbadcap = 0;
        void *nbuf;
        off_t noff, coff, name_off;
@@ -1203,8 +1203,9 @@
        /* Read offset of name section to be able to read section names later */
        if (pread(fd, xsh_addr, xsh_sizeof, CAST(off_t, (off + size * strtab)))
            < (ssize_t)xsh_sizeof) {
-               file_badread(ms);
-               return -1;
+               if (file_printf(ms, ", missing section headers") == -1)
+                       return -1;
+               return 0;
        }
        name_off = xsh_offset;
 
@@ -1215,8 +1216,10 @@
                        return -1;
                }
                name[namesize] = '\0';
-               if (strcmp(name, ".debug_info") == 0)
+               if (strcmp(name, ".debug_info") == 0) {
+                       has_debug_info = 1;
                        stripped = 0;
+               }
 
                if (pread(fd, xsh_addr, xsh_sizeof, off) < (ssize_t)xsh_sizeof) 
{
                        file_badread(ms);
@@ -1372,6 +1375,10 @@
 
        if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
                return -1;
+       if (has_debug_info) {
+               if (file_printf(ms, ", with debug_info") == -1)
+                       return -1;
+       }
        if (cap_hw1) {
                const cap_desc_t *cdp;
                switch (mach) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/file-5.29/src/softmagic.c new/file-5.30/src/softmagic.c
--- old/file-5.29/src/softmagic.c       2016-10-24 20:02:17.000000000 +0200
+++ new/file-5.30/src/softmagic.c       2017-02-08 00:27:32.000000000 +0100
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.238 2016/10/24 18:02:17 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.243 2017/02/07 23:27:32 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -1260,7 +1260,8 @@
                                if (*dst == '\0') {
                                        if (type == FILE_BESTRING16 ?
                                            *(src - 1) != '\0' :
-                                           *(src + 1) != '\0')
+                                           ((src + 1 < esrc) &&
+                                           *(src + 1) != '\0'))
                                                *dst = ' ';
                                }
                        }
@@ -1842,14 +1843,14 @@
                v = 0;
 
                for (idx = 0; m->str_range == 0 || idx < m->str_range; idx++) {
-                       if (slen + idx > ms->search.s_len)
-                               break;
+                       if (slen + idx >= ms->search.s_len)
+                               return 0;
 
                        v = file_strncmp(m->value.s, ms->search.s + idx, slen,
                            m->str_flags);
                        if (v == 0) {   /* found match */
                                ms->search.offset += idx;
-                               ms->search.rm_len = m->str_range - idx;
+                               ms->search.rm_len = ms->search.s_len - idx;
                                break;
                        }
                }
@@ -1887,7 +1888,7 @@
                            copy[--slen] = '\0';
                            search = copy;
                        } else {
-                           search = ms->search.s;
+                           search = CCAST(char *, "");
                            copy = NULL;
                        }
                        rc = file_regexec(&rx, (const char *)search,


Reply via email to