]> granicus.if.org Git - file/commitdiff
- Warn about continuation levels which are not contiguous when increasing.
authorChristos Zoulas <christos@zoulas.com>
Fri, 11 Jan 2013 16:45:23 +0000 (16:45 +0000)
committerChristos Zoulas <christos@zoulas.com>
Fri, 11 Jan 2013 16:45:23 +0000 (16:45 +0000)
- Fix broken magic files discovered by that test.

ChangeLog
magic/Magdir/cafebabe
magic/Magdir/digital
magic/Magdir/maple
magic/Magdir/rpm
src/apprentice.c

index 2bb5e0a040d1e06af5b7d19cf5e8ee8c01e34dbe..4cd4f315761f5174ab8f6523c1dc3e02016243e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,14 @@
-2013-01-10  11:20  Christos Zoulas <christos@zoulas.com>
+2013-01-10  11:40  Christos Zoulas <christos@zoulas.com>
+
+       * Warn about inconsistent continuation levels.
+
+2013-01-10  21:00  Christos Zoulas <christos@zoulas.com>
 
        * Make getline public so that file can link against it.
          Perhaps it is better to rename it, or hide it differently.
          Fixes builds on platforms that do not provide it.
          
-2013-01-07  11:20  Christos Zoulas <christos@zoulas.com>
+2013-01-07  16:30  Christos Zoulas <christos@zoulas.com>
 
        * Add SuS d{,1,2,4,8}, u{,1,2,4,8} and document
          what long, int, short, etc is (Guy Harris)
index 4150014e9ad598d694d7faa345c56b649deb09ac..ea4846d86685383799be2d386ba88607e90915d2 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: cafebabe,v 1.11 2013/01/04 23:27:55 christos Exp $
+# $File: cafebabe,v 1.12 2013/01/11 16:45:23 christos Exp $
 # Cafe Babes unite!
 #
 # Since Java bytecode and Mach-O universal binaries have the same magic number,
 >>4    belong          0x0032          (Java 1.6)
 
 0      belong          0xcafed00d      JAR compressed with pack200,
->>5    byte            x               version %d.
->>4    byte            x               \b%d
+>    byte            x               version %d.
+>    byte            x               \b%d
 !:mime application/x-java-pack200
 
 
 0      belong          0xcafed00d      JAR compressed with pack200,
->>5    byte            x               version %d.
->>4    byte            x               \b%d
+>    byte            x               version %d.
+>    byte            x               \b%d
 !:mime application/x-java-pack200
 
 ### JAVA END ###
index b1b77dd8c75fcb11acb5864a11da8add67fb6c2b..f66e0bc55917a01164a915e873a1a25af1bc0b44 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: digital,v 1.10 2011/05/03 01:44:17 christos Exp $
+# $File: digital,v 1.11 2013/01/11 16:45:23 christos Exp $
 #  Digital UNIX - Info
 #
 0      string  =!<arch>\n________64E   Alpha archive
@@ -8,20 +8,20 @@
 #
 
 0      leshort         0603
->>24   leshort         0410            COFF format alpha pure
->>24   leshort         0413            COFF format alpha demand paged
->>>22  leshort&030000  !020000         executable
->>>22  leshort&020000  !0              dynamically linked
->>>16  lelong          !0              not stripped
->>>16  lelong          0               stripped
->>>27  byte            x               - version %d
->>>26  byte            x               \b.%d
->>>28  byte            x               \b-%d
->>24   leshort         0407            COFF format alpha object
->>>22  leshort&030000  020000          shared library
->>>27  byte            x               - version %d
->>>26  byte            x               \b.%d
->>>28  byte            x               \b-%d
+>24    leshort         0410            COFF format alpha pure
+>24    leshort         0413            COFF format alpha demand paged
+>>22   leshort&030000  !020000         executable
+>>22   leshort&020000  !0              dynamically linked
+>>16   lelong          !0              not stripped
+>>16   lelong          0               stripped
+>>27   byte            x               - version %d
+>>26   byte            x               \b.%d
+>>28   byte            x               \b-%d
+>24    leshort         0407            COFF format alpha object
+>>22   leshort&030000  020000          shared library
+>>27   byte            x               - version %d
+>>26   byte            x               \b.%d
+>>28   byte            x               \b-%d
 
 # Basic recognition of Digital UNIX core dumps - Mike Bremford <mike@opac.bl.uk>
 #
index 4a263e084691d2b04c77b9c37d96f128b69ed4df..05a8eaf298be991ea1ce3fb2c1af3c4db62dee22 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: maple,v 1.6 2009/09/19 16:28:10 christos Exp $
+# $File: maple,v 1.7 2013/01/11 16:45:23 christos Exp $
 # maple:  file(1) magic for maple files
 # "H. Nanosecond" <aldomel@ix.netcom.com>
 # Maple V release 4, a multi-purpose math program
@@ -33,7 +33,7 @@
 # that is {VERSION major_version miunor_version computer_type version_string}
 0      string  {VERSION\       Maple worksheet
 >9     string  >\0     version %.1s.
->>>11  string  >\0     %.1s
+>>11   string  >\0     %.1s
 
 # .mps
 0      string  \0\0\001$       Maple something
index 85232c6cd1602cd6b634db52548623f1ec180d09..9a795f841adebed39f3f4ff8426bfa55289d191a 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: rpm,v 1.11 2011/06/14 12:47:41 christos Exp $
+# $File: rpm,v 1.12 2013/01/11 16:45:23 christos Exp $
 #
 # RPM: file(1) magic for Red Hat Packages   Erik Troan (ewt@redhat.com)
 #
 >>8    beshort         255             noarch
 
 #delta RPM    Daniel Novotny (dnovotny@redhat.com)
-0      string  drpm    Delta RPM
+0      string          drpm            Delta RPM
 !:mime  application/x-rpm
 >12    string  x       %s
-
->>>8   beshort         11              MIPSel
->>>8   beshort         12              ARM
->>>8   beshort         13              MiNT
->>>8   beshort         14              S/390
->>>8   beshort         15              S/390x
->>>8   beshort         16              PowerPC64
->>>8   beshort         17              SuperH
->>>8   beshort         18              Xtensa
+>>8    beshort         11              MIPSel
+>>8    beshort         12              ARM
+>>8    beshort         13              MiNT
+>>8    beshort         14              S/390
+>>8    beshort         15              S/390x
+>>8    beshort         16              PowerPC64
+>>8    beshort         17              SuperH
+>>8    beshort         18              Xtensa
 >>10   string          x               %s
-
-# Type:        Delta RPM
-# From:        Daniel Novotny (dnovotny@redhat.com)
-0      string          drpm            Delta RPM
-!:mime application/x-rpm
->12    string          x               %s
index 9a83fa0ddb2d814269566d73f6bf961ef759847c..e59b0458fef36b031504b6d9467e43a3f53e3d2d 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.188 2013/01/09 15:36:55 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.189 2013/01/11 16:45:23 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -1461,6 +1461,7 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
        char *t;
        int op;
        uint32_t cont_level;
+       int32_t diff;
 
        cont_level = 0;
 
@@ -1482,6 +1483,16 @@ parse(struct magic_set *ms, struct magic_entry *me, const char *line,
                        file_magerror(ms, "No current entry for continuation");
                        return -1;
                }
+               if (me->cont_count == 0) {
+                       file_magerror(ms, "Continuations present with 0 count");
+                       return -1;
+               }
+               m = &me->mp[me->cont_count - 1];
+               diff = (int32_t)cont_level - (int32_t)m->cont_level;
+               if (diff > 1)
+                       file_magwarn(ms, "New continuation level %u is more "
+                           "than one larger than current level %u", cont_level,
+                           m->cont_level);
                if (me->cont_count == me->max_count) {
                        struct magic *nm;
                        size_t cnt = me->max_count + ALLOC_CHUNK;