Browse Source

Include all upstream commits since the 5.29 release

Christoph Biedl 7 years ago
parent
commit
bde9a89787
2 changed files with 340 additions and 6 deletions
  1. 339 5
      debian/patches/cherry-pick.FILE5_29-23-gc8ef8f4.combined.patch
  2. 1 1
      debian/patches/series

+ 339 - 5
debian/patches/cherry-pick.FILE5_29-23-gc8ef8f4.combined.patch

@@ -1,7 +1,10 @@
 Subject: Combined patch of all commits since the 5.29 release
-Origin: FILE5_29..FILE5_29-23-gc8ef8f4
+Origin: FILE5_29..FILE5_29-38-gafec4e7c
 Upstream-Author: Christos Zoulas <christos@zoulas.com>
-Date: Sat Dec 10 14:21:29 2016 +0000
+Date: Sun Jan 22 22:02:15 2017 +0000
+
+    Excluded: a317154a ("compute the search match length correctly (found by oss-fuzzer)"
+    as it introduces a regression.
 
 --- a/ChangeLog
 +++ b/ChangeLog
@@ -18,6 +21,86 @@ Date: Sat Dec 10 14:21:29 2016 +0000
  
  2016-10-24  11:20  Christos Zoulas <christos@zoulas.com>
  
+--- a/doc/file.man
++++ b/doc/file.man
+@@ -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 cudcv@warwick.ac.uk ,
+ 1989.
+ .Pp
+-Guy Harris, 
++Guy Harris,
+ .Aq guy@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.
 --- a/doc/magic.man
 +++ b/doc/magic.man
 @@ -7,7 +7,7 @@
@@ -53,6 +136,25 @@ Date: Sat Dec 10 14:21:29 2016 +0000
  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.
+--- a/magic/Magdir/animation
++++ b/magic/Magdir/animation
+@@ -855,10 +855,12 @@
+ 
+ # X3D (Extensible 3D) [http://www.web3d.org/specifications/x3d-3.0.dtd]
+ # From Michel Briand <michelbriand@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
 --- a/magic/Magdir/audio
 +++ b/magic/Magdir/audio
 @@ -469,6 +469,8 @@
@@ -66,7 +168,102 @@ Date: Sat Dec 10 14:21:29 2016 +0000
  >>17	belong&0xfffff0		0x07d000	\b, 32 kHz
 --- a/magic/Magdir/console
 +++ b/magic/Magdir/console
-@@ -617,6 +617,52 @@
+@@ -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 <gerbilsoft@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 <gerbilsoft@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
+ #
+@@ -617,6 +641,52 @@
  >0x218	belong	0x5D1C9EA3	Nintendo Wii disc image (WBFS format):
  >>0x200	use	nintendo-gcn-disc-common
  
@@ -119,7 +316,7 @@ Date: Sat Dec 10 14:21:29 2016 +0000
  #------------------------------------------------------------------------------
  # Nintendo 3DS file formats.
  #
-@@ -750,3 +796,17 @@
+@@ -750,3 +820,17 @@
  #
  0	string	g\ GCE	Vectrex ROM image
  >0x11	string	>\0	\b: "%.16s"
@@ -160,6 +357,20 @@ Date: Sat Dec 10 14:21:29 2016 +0000
  
  # cramfs filesystem - russell@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
 --- a/magic/Magdir/fonts
 +++ b/magic/Magdir/fonts
 @@ -100,9 +100,11 @@
@@ -513,7 +724,15 @@ Date: Sat Dec 10 14:21:29 2016 +0000
  512	string/b	\354\245\301			Microsoft Word Document
  !:mime	application/msword
  
-@@ -1106,3 +1119,40 @@
+@@ -960,6 +973,7 @@
+ # DOS EPS Binary File Header
+ # From: Ed Sznyter <ews@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
  
@@ -583,6 +802,39 @@ Date: Sat Dec 10 14:21:29 2016 +0000
  
  
  0x3C000	string/b		AB
+--- a/magic/Magdir/pbf
++++ b/magic/Magdir/pbf
+@@ -6,6 +6,6 @@
+ # OpenStreetMap Protocolbuffer Binary Format (.osm.pbf)
+ # http://wiki.openstreetmap.org/wiki/PBF_Format
+ # From: Markus Heidelberg <markus.heidelberg@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
+--- a/magic/Magdir/pgp
++++ b/magic/Magdir/pgp
+@@ -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
 --- a/magic/Magdir/sgml
 +++ b/magic/Magdir/sgml
 @@ -46,6 +46,12 @@
@@ -598,6 +850,34 @@ Date: Sat Dec 10 14:21:29 2016 +0000
  0	search/4096/cwt	\<head\>		HTML document text
  !:mime	text/html
  !:strength + 5
+--- a/magic/Magdir/ssl
++++ b/magic/Magdir/ssl
+@@ -1,8 +1,20 @@
++
++#------------------------------------------------------------------------------
++# $File: ssl,v 1.3 2017/01/18 14:59:19 christos Exp $
++# ssl:  file(1) magic for SSL file formats
++
+ # Type: OpenSSL certificates/key files
+ # From: Nicolas Collignon <tsointsoin@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
 --- /dev/null
 +++ b/magic/Magdir/yara
 @@ -0,0 +1,17 @@
@@ -659,6 +939,25 @@ Date: Sat Dec 10 14:21:29 2016 +0000
  	if (scn->sst_len == (size_t)-1)
  		goto out;
  
+--- a/src/compress.c
++++ b/src/compress.c
+@@ -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()))";
 --- a/src/der.c
 +++ b/src/der.c
 @@ -159,31 +159,49 @@
@@ -730,3 +1029,38 @@ Date: Sat Dec 10 14:21:29 2016 +0000
  	return -1;
  }
  
+--- a/src/readelf.c
++++ b/src/readelf.c
+@@ -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;
+ 
+--- a/src/softmagic.c
++++ b/src/softmagic.c
+@@ -1260,7 +1260,8 @@
+ 				if (*dst == '\0') {
+ 					if (type == FILE_BESTRING16 ?
+ 					    *(src - 1) != '\0' :
+-					    *(src + 1) != '\0')
++					    ((src + 1 < esrc) &&
++					    *(src + 1) != '\0'))
+ 						*dst = ' ';
+ 				}
+ 			}
+@@ -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,

+ 1 - 1
debian/patches/series

@@ -1,5 +1,5 @@
 # cherry-picked commits. Keep in upstream's chronological order
-cherry-pick.FILE5_29-23-gc8ef8f4.combined.patch
+cherry-pick.FILE5_29-38-gafec4e7c.combined.patch
 
 # local modifications
 local.support-local-definitions-in-etc-magic.patch