Imported Upstream version 5.24 53/75653/1 upstream/5.24
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 21 Jun 2016 01:25:44 +0000 (10:25 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 21 Jun 2016 01:25:52 +0000 (10:25 +0900)
Change-Id: I0d185b8b59b332734f4c335deb70374ca0eb8a3c
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
12 files changed:
ChangeLog
configure.ac
magic/Magdir/database
magic/Magdir/elf
magic/Magdir/fortran
magic/Magdir/mail.news
magic/Magdir/map
src/file.c
src/file_opts.h
src/funcs.c
src/readelf.c
tests/fit-map-data.result

index 1ac5ad2..1fb44a2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-07-09  10:35  Christos Zoulas <christos@zoulas.com>
+
+       * release 5.24
+
+2015-06-11   8:52  Christos Zoulas <christos@zoulas.com>
+
+       * redo long option encoding to fix off-by-one in 5.23
 
 2015-06-10  13:50  Christos Zoulas <christos@zoulas.com>
 
index 857b7fe..a48e445 100644 (file)
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT([file],[5.23],[christos@astron.com])
+AC_INIT([file],[5.24],[christos@astron.com])
 AM_INIT_AUTOMAKE([subdir-objects foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
index 0941a11..13f163b 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: database,v 1.42 2014/08/19 14:18:04 christos Exp $
+# $File: database,v 1.43 2014/10/28 15:47:39 christos Exp $
 # database:  file(1) magic for various databases
 #
 # extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk)
 
 # From:  Stephane Blondon http://www.yaal.fr
 # Database file for Zope (done by FileStorage)
-0      string          FS21    Zope Object Database File Storage (data)
+0      string  FS21    Zope Object Database File Storage v3 (data)
+0      string  FS30    Zope Object Database File Storage v4 (data)
+
 # Cache file for the database of Zope (done by ClientStorage)
 0      string          ZEC3    Zope Object Database Client Cache File (data)
 
index b7e9d99..d818088 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: elf,v 1.67 2014/06/12 13:52:48 christos Exp $
+# $File: elf,v 1.68 2014/09/19 19:05:57 christos Exp $
 # elf:  file(1) magic for ELF executables
 #
 # We have to check the byte order flag to see what byte order all the
 # Modified by (4): <gerardo.cacciari@gmail.com> (VMS Itanium)
 # Modified by (5): Matthias Urlichs <smurf@debian.org> (Listing of many architectures)
 
+0      name            elf-mips
+>0     lelong&0xf0000000       0x00000000      MIPS-I
+>0     lelong&0xf0000000       0x10000000      MIPS-II
+>0     lelong&0xf0000000       0x20000000      MIPS-III
+>0     lelong&0xf0000000       0x30000000      MIPS-IV
+>0     lelong&0xf0000000       0x40000000      MIPS-V
+>0     lelong&0xf0000000       0x50000000      MIPS32
+>0     lelong&0xf0000000       0x60000000      MIPS64
+>0     lelong&0xf0000000       0x70000000      MIPS32 rel2
+>0     lelong&0xf0000000       0x80000000      MIPS64 rel2
+>0     lelong&0xf0000000       0x90000000      MIPS32 rel6
+>0     lelong&0xf0000000       0xa0000000      MIPS64 rel6
+
+0      name            elf-sparc
+>0     lelong&0x00ffff00       0x00000100      V8+ Required,
+>0     lelong&0x00ffff00       0x00000200      Sun UltraSPARC1 Extensions Required,
+>0     lelong&0x00ffff00       0x00000400      HaL R1 Extensions Required,
+>0     lelong&0x00ffff00       0x00000800      Sun UltraSPARC3 Extensions Required,
+>0     lelong&0x3              0               total store ordering,
+>0     lelong&0x3              1               partial store ordering,
+>0     lelong&0x3              2               relaxed memory ordering,
+
+0      name            elf-pa-risc
+>2     leshort         0x0214          2.0
+>0     leshort         &0x0008         (LP64)
+
 0      name            elf-le
 >16    leshort         0               no file type,
 !:mime application/octet-stream
 >18    leshort         8
 # only for 32-bit
 >>4    byte            1
->>>36  lelong&0xf0000000       0x00000000      MIPS-I
->>>36  lelong&0xf0000000       0x10000000      MIPS-II
->>>36  lelong&0xf0000000       0x20000000      MIPS-III
->>>36  lelong&0xf0000000       0x30000000      MIPS-IV
->>>36  lelong&0xf0000000       0x40000000      MIPS-V
->>>36  lelong&0xf0000000       0x50000000      MIPS32
->>>36  lelong&0xf0000000       0x60000000      MIPS64
->>>36  lelong&0xf0000000       0x70000000      MIPS32 rel2
->>>36  lelong&0xf0000000       0x80000000      MIPS64 rel2
+>>>36  use             elf-mips
 # only for 64-bit
 >>4    byte            2
->>>48  lelong&0xf0000000       0x00000000      MIPS-I
->>>48  lelong&0xf0000000       0x10000000      MIPS-II
->>>48  lelong&0xf0000000       0x20000000      MIPS-III
->>>48  lelong&0xf0000000       0x30000000      MIPS-IV
->>>48  lelong&0xf0000000       0x40000000      MIPS-V
->>>48  lelong&0xf0000000       0x50000000      MIPS32
->>>48  lelong&0xf0000000       0x60000000      MIPS64
->>>48  lelong&0xf0000000       0x70000000      MIPS32 rel2
->>>48  lelong&0xf0000000       0x80000000      MIPS64 rel2
+>>>48  use             elf-mips
 >18    leshort         9               Amdahl,
 >18    leshort         10              MIPS (deprecated),
 >18    leshort         11              RS6000,
 >18    leshort         15              PA-RISC,
 # only for 32-bit
 >>4    byte            1
->>>38  leshort         0x0214          2.0
->>>36  leshort         &0x0008         (LP64)
+>>>36  use             elf-pa-risc
 # only for 64-bit
 >>4    byte            2
->>>50  leshort         0x0214          2.0
->>>48  leshort         &0x0008         (LP64)
+>>>48  use             elf-pa-risc
 >18    leshort         16              nCUBE,
 >18    leshort         17              Fujitsu VPP500,
 >18    leshort         18              SPARC32PLUS,
 # only for 32-bit
 >>4    byte            1
->>>36  lelong&0xffff00 0x000100        V8+ Required,
->>>36  lelong&0xffff00 0x000200        Sun UltraSPARC1 Extensions Required,
->>>36  lelong&0xffff00 0x000400        HaL R1 Extensions Required,
->>>36  lelong&0xffff00 0x000800        Sun UltraSPARC3 Extensions Required,
+>>>36  use             elf-sparc
 >18    leshort         19              Intel 80960,
 >18    leshort         20              PowerPC or cisco 4500,
 >18    leshort         21              64-bit PowerPC or cisco 7500,
 >18    leshort         42              Renesas SH,
 >18    leshort         43              SPARC V9,
 >>4    byte            2
->>>48  lelong&0xffff00 0x000200        Sun UltraSPARC1 Extensions Required,
->>>48  lelong&0xffff00 0x000400        HaL R1 Extensions Required,
->>>48  lelong&0xffff00 0x000800        Sun UltraSPARC3 Extensions Required,
->>>48  lelong&0x3      0               total store ordering,
->>>48  lelong&0x3      1               partial store ordering,
->>>48  lelong&0x3      2               relaxed memory ordering,
+>>>48  use             elf-sparc
 >18    leshort         44              Siemens Tricore Embedded Processor,
 >18    leshort         45              Argonaut RISC Core, Argonaut Technologies Inc.,
 >18    leshort         46              Renesas H8/300,
index 320331e..ac2610e 100644 (file)
@@ -1,7 +1,7 @@
 
 #------------------------------------------------------------------------------
-# $File: fortran,v 1.7 2012/06/21 01:55:02 christos Exp $
+# $File: fortran,v 1.8 2014/06/03 19:01:34 christos Exp $
 # FORTRAN source
-0      regex/100l      \^[Cc][\ \t]    FORTRAN program
+0      regex/100l      \^[Cc][\ \t]    FORTRAN program text
 !:mime text/x-fortran
 !:strength - 5
index b34ceed..e54f0e7 100644 (file)
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: mail.news,v 1.21 2012/06/21 01:44:52 christos Exp $
+# $File: mail.news,v 1.22 2013/01/04 14:22:07 christos Exp $
 # mail.news:  file(1) magic for mail and news
 #
 # Unfortunately, saved netnews also has From line added in some news software.
@@ -41,6 +41,7 @@
 
 # From: Simon Matter <simon.matter@invoca.ch>
 0      string          \241\002\213\015skiplist\ file\0\0\0    Cyrus skiplist DB
+0      string          \241\002\213\015twoskip\ file\0\0\0\0   Cyrus twoskip DB
 
 # JAM(mbp) Fidonet message area databases
 # JHR file
index 8d65d26..1c794bf 100644 (file)
@@ -1,7 +1,7 @@
 
 
 #------------------------------------------------------------------------------
-# $File: msdos,v 1.99 2014/06/03 01:40:24 christos Exp $
+# $File: map,v 1.2 2015/07/09 15:13:51 christos Exp $
 # map:  file(1) magic for Map data
 #
 
@@ -9,9 +9,11 @@
 8      string  .FIT            FIT Map data
 >15    byte    0
 >>35   belong  x               \b, unit id %d
-# 20 years after unix epoch
 >>39   lelong  x               \b, serial %u
->>43   ledate/631152000 x      \b, %s
+# http://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
+# 20 years after unix epoch
+# TZ=GMT date -d '1989-12-31 0:00' +%s
+>>43   leldate+631065600       x       \b, %s
 
 >>47   leshort x               \b, manufacturer %d
 >>47   leshort 1               \b (garmin)
index f60dde0..c700f66 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: file.c,v 1.163 2015/04/09 20:01:41 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.164 2015/06/03 18:21:24 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -89,10 +89,15 @@ private int                 /* Global command-line options          */
 
 private const char *separator = ":";   /* Default field separator      */
 private const struct option long_options[] = {
+#define OPT_HELP               1
+#define OPT_APPLE              2
+#define OPT_EXTENSIONS         3
+#define OPT_MIME_TYPE          4
+#define OPT_MIME_ENCODING      5
 #define OPT(shortname, longname, opt, doc)      \
     {longname, opt, NULL, shortname},
-#define OPT_LONGONLY(longname, opt, doc)        \
-    {longname, opt, NULL, 0},
+#define OPT_LONGONLY(longname, opt, doc, id)        \
+    {longname, opt, NULL, id},
 #include "file_opts.h"
 #undef OPT
 #undef OPT_LONGONLY
@@ -182,24 +187,20 @@ main(int argc, char *argv[])
        while ((c = getopt_long(argc, argv, OPTSTRING, long_options,
            &longindex)) != -1)
                switch (c) {
-               case 0 :
-                       switch (longindex) {
-                       case 0:
-                               help();
-                               break;
-                       case 10:
-                               flags |= MAGIC_APPLE;
-                               break;
-                       case 11:
-                               flags |= MAGIC_EXTENSION;
-                               break;
-                       case 12:
-                               flags |= MAGIC_MIME_TYPE;
-                               break;
-                       case 13:
-                               flags |= MAGIC_MIME_ENCODING;
-                               break;
-                       }
+               case OPT_HELP:
+                       help();
+                       break;
+               case OPT_APPLE:
+                       flags |= MAGIC_APPLE;
+                       break;
+               case OPT_EXTENSIONS:
+                       flags |= MAGIC_EXTENSION;
+                       break;
+               case OPT_MIME_TYPE:
+                       flags |= MAGIC_MIME_TYPE;
+                       break;
+               case OPT_MIME_ENCODING:
+                       flags |= MAGIC_MIME_ENCODING;
                        break;
                case '0':
                        nulsep = 1;
@@ -595,7 +596,7 @@ help(void)
 #define OPT(shortname, longname, opt, doc)      \
        fprintf(stdout, "  -%c, --" longname, shortname), \
        docprint(doc);
-#define OPT_LONGONLY(longname, opt, doc)        \
+#define OPT_LONGONLY(longname, opt, doc, id)        \
        fprintf(stdout, "      --" longname),   \
        docprint(doc);
 #include "file_opts.h"
index 036505f..2e30d06 100644 (file)
@@ -12,7 +12,7 @@
  * switch statement!
  */
 
-OPT_LONGONLY("help", 0, "                 display this help and exit\n")
+OPT_LONGONLY("help", 0, "                 display this help and exit\n", OPT_HELP)
 OPT('v', "version", 0, "              output version information and exit\n")
 OPT('m', "magic-file", 1, " LIST      use LIST as a colon-separated list of magic\n"
     "                               number files\n")
@@ -29,10 +29,10 @@ OPT('f', "files-from", 1, " FILE      read the filenames to be examined from FIL
 OPT('F', "separator", 1, " STRING     use string as separator instead of `:'\n")
 OPT('i', "mime", 0, "                 output MIME type strings (--mime-type and\n"
     "                               --mime-encoding)\n")
-OPT_LONGONLY("apple", 0, "                output the Apple CREATOR/TYPE\n")
-OPT_LONGONLY("extension", 0, "            output a slash-separated list of extnsions\n")
-OPT_LONGONLY("mime-type", 0, "            output the MIME type\n")
-OPT_LONGONLY("mime-encoding", 0, "        output the MIME encoding\n")
+OPT_LONGONLY("apple", 0, "                output the Apple CREATOR/TYPE\n", OPT_APPLE)
+OPT_LONGONLY("extension", 0, "            output a slash-separated list of extensions\n", OPT_EXTENSIONS)
+OPT_LONGONLY("mime-type", 0, "            output the MIME type\n", OPT_MIME_TYPE)
+OPT_LONGONLY("mime-encoding", 0, "        output the MIME encoding\n", OPT_MIME_ENCODING)
 OPT('k', "keep-going", 0, "           don't stop at the first match\n")
 OPT('l', "list", 0, "                 list magic strength\n")
 #ifdef S_IFLNK
index b7160cc..febd3bc 100644 (file)
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: funcs.c,v 1.81 2015/05/28 19:26:59 christos Exp $")
+FILE_RCSID("@(#)$File: funcs.c,v 1.82 2015/06/03 18:01:20 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -107,8 +107,10 @@ file_error_core(struct magic_set *ms, int error, const char *f, va_list va,
        if (lineno != 0) {
                free(ms->o.buf);
                ms->o.buf = NULL;
-               file_printf(ms, "line %" SIZE_T_FORMAT "u: ", lineno);
+               file_printf(ms, "line %" SIZE_T_FORMAT "u:", lineno);
        }
+       if (ms->o.buf && *ms->o.buf)
+               file_printf(ms, " ");
        file_vprintf(ms, f, va);
        if (error > 0)
                file_printf(ms, " (%s)", strerror(error));
index ce6e176..4062ed6 100644 (file)
@@ -27,7 +27,7 @@
 #include "file.h"
 
 #ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.118 2015/01/02 21:29:39 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.119 2015/04/09 20:01:41 christos Exp $")
 #endif
 
 #ifdef BUILTIN_ELF
@@ -1048,9 +1048,18 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
                        break;
                }
 
+
                /* Things we can determine when we seek */
                switch (xsh_type) {
                case SHT_NOTE:
+                       if (xsh_size + xsh_offset > (uintmax_t)fsize)  {
+                               if (file_printf(ms,
+                                   ", note offset/size 0x%jx+0x%jx exceeds"
+                                   " file size 0x%jx", (uintmax_t)xsh_offset,
+                                   (uintmax_t)xsh_size, (uintmax_t)fsize) == -1)
+                                       return -1;
+                               return 0; 
+                       }
                        if ((nbuf = malloc(xsh_size)) == NULL) {
                                file_error(ms, errno, "Cannot allocate memory"
                                    " for note");
index ba1a8e6..90bf20d 100644 (file)
@@ -1 +1 @@
-FIT Map data, unit id 65536, serial 3879446968, Sun Jun  1 06:00:34 2014, manufacturer 1 (garmin), product 1632, type 4 (Activity)
+FIT Map data, unit id 65536, serial 3879446968, Sat May 31 06:00:34 2014, manufacturer 1 (garmin), product 1632, type 4 (Activity)
\ No newline at end of file