From: Christos Zoulas Date: Fri, 11 Jan 2013 16:45:23 +0000 (+0000) Subject: - Warn about continuation levels which are not contiguous when increasing. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=51ae6e7adcdaae7762aea78ce2076e5efaa3be51;p=file - Warn about continuation levels which are not contiguous when increasing. - Fix broken magic files discovered by that test. --- diff --git a/ChangeLog b/ChangeLog index 2bb5e0a0..4cd4f315 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,14 @@ -2013-01-10 11:20 Christos Zoulas +2013-01-10 11:40 Christos Zoulas + + * Warn about inconsistent continuation levels. + +2013-01-10 21:00 Christos Zoulas * 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 +2013-01-07 16:30 Christos Zoulas * Add SuS d{,1,2,4,8}, u{,1,2,4,8} and document what long, int, short, etc is (Guy Harris) diff --git a/magic/Magdir/cafebabe b/magic/Magdir/cafebabe index 4150014e..ea4846d8 100644 --- a/magic/Magdir/cafebabe +++ b/magic/Magdir/cafebabe @@ -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, @@ -30,14 +30,14 @@ >>4 belong 0x0032 (Java 1.6) 0 belong 0xcafed00d JAR compressed with pack200, ->>5 byte x version %d. ->>4 byte x \b%d +>5 byte x version %d. +>4 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 +>5 byte x version %d. +>4 byte x \b%d !:mime application/x-java-pack200 ### JAVA END ### diff --git a/magic/Magdir/digital b/magic/Magdir/digital index b1b77dd8..f66e0bc5 100644 --- a/magic/Magdir/digital +++ b/magic/Magdir/digital @@ -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 =!\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 # diff --git a/magic/Magdir/maple b/magic/Magdir/maple index 4a263e08..05a8eaf2 100644 --- a/magic/Magdir/maple +++ b/magic/Magdir/maple @@ -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" # 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 diff --git a/magic/Magdir/rpm b/magic/Magdir/rpm index 85232c6c..9a795f84 100644 --- a/magic/Magdir/rpm +++ b/magic/Magdir/rpm @@ -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) # @@ -31,22 +31,15 @@ >>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 diff --git a/src/apprentice.c b/src/apprentice.c index 9a83fa0d..e59b0458 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -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;