head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC4:1.1.1.6
	netbsd-11-0-RC3:1.1.1.6
	netbsd-11-0-RC2:1.1.1.6
	netbsd-11-0-RC1:1.1.1.6
	perseant-exfatfs-base-20250801:1.1.1.6
	netbsd-11:1.1.1.6.0.6
	netbsd-11-base:1.1.1.6
	netbsd-10-1-RELEASE:1.1.1.6
	perseant-exfatfs-base-20240630:1.1.1.6
	perseant-exfatfs:1.1.1.6.0.4
	perseant-exfatfs-base:1.1.1.6
	netbsd-9-4-RELEASE:1.1.1.2
	netbsd-10-0-RELEASE:1.1.1.6
	netbsd-10-0-RC6:1.1.1.6
	netbsd-10-0-RC5:1.1.1.6
	netbsd-10-0-RC4:1.1.1.6
	netbsd-10-0-RC3:1.1.1.6
	netbsd-10-0-RC2:1.1.1.6
	netbsd-10-0-RC1:1.1.1.6
	FILE5_45:1.1.1.6
	netbsd-10:1.1.1.6.0.2
	netbsd-10-base:1.1.1.6
	FILE5_43:1.1.1.6
	netbsd-9-3-RELEASE:1.1.1.2
	cjep_sun2x-base1:1.1.1.5
	cjep_sun2x:1.1.1.5.0.4
	cjep_sun2x-base:1.1.1.5
	cjep_staticlib_x-base1:1.1.1.5
	netbsd-9-2-RELEASE:1.1.1.2
	cjep_staticlib_x:1.1.1.5.0.2
	cjep_staticlib_x-base:1.1.1.5
	FILE5_40:1.1.1.5
	netbsd-9-1-RELEASE:1.1.1.2
	FILE5_39:1.1.1.4
	phil-wifi-20200421:1.1.1.3
	phil-wifi-20200411:1.1.1.3
	is-mlppp:1.1.1.3.0.2
	is-mlppp-base:1.1.1.3
	phil-wifi-20200406:1.1.1.3
	netbsd-9-0-RELEASE:1.1.1.2
	netbsd-9-0-RC2:1.1.1.2
	FILE5_38:1.1.1.3
	netbsd-9-0-RC1:1.1.1.2
	phil-wifi-20191119:1.1.1.2
	netbsd-9:1.1.1.2.0.2
	netbsd-9-base:1.1.1.2
	phil-wifi-20190609:1.1.1.2
	FILE5_37:1.1.1.2
	pgoyette-compat-merge-20190127:1.1.1.1.2.2
	pgoyette-compat-20190127:1.1.1.1
	pgoyette-compat-20190118:1.1.1.1
	pgoyette-compat-1226:1.1.1.1
	pgoyette-compat-1126:1.1.1.1
	pgoyette-compat-1020:1.1.1.1
	FILE5_35:1.1.1.1
	pgoyette-compat-0930:1.1.1.1
	pgoyette-compat-0906:1.1.1.1
	pgoyette-compat-0728:1.1.1.1
	phil-wifi:1.1.1.1.0.4
	phil-wifi-base:1.1.1.1
	pgoyette-compat-0625:1.1.1.1
	pgoyette-compat-0521:1.1.1.1
	pgoyette-compat-0502:1.1.1.1
	pgoyette-compat:1.1.1.1.0.2
	pgoyette-compat-0422:1.1.1.1
	FILE5_33:1.1.1.1
	CHRISTOS:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2018.04.15.19.32.47;	author christos;	state Exp;
branches
	1.1.1.1;
next	;
commitid	unKSwpX2g9VqBzyA;

1.1.1.1
date	2018.04.15.19.32.47;	author christos;	state Exp;
branches
	1.1.1.1.2.1
	1.1.1.1.4.1;
next	1.1.1.2;
commitid	unKSwpX2g9VqBzyA;

1.1.1.2
date	2019.05.22.17.19.57;	author christos;	state Exp;
branches;
next	1.1.1.3;
commitid	VXeNRYYruN1MWdoB;

1.1.1.3
date	2019.12.17.02.23.53;	author christos;	state Exp;
branches;
next	1.1.1.4;
commitid	vqYTz60fS9PNg0PB;

1.1.1.4
date	2020.06.15.00.18.49;	author christos;	state Exp;
branches;
next	1.1.1.5;
commitid	HMbuXSjPojU5LfcC;

1.1.1.5
date	2021.04.09.18.58.02;	author christos;	state Exp;
branches;
next	1.1.1.6;
commitid	W9ddLLbSkHHinEOC;

1.1.1.6
date	2022.09.24.20.07.54;	author christos;	state Exp;
branches;
next	;
commitid	Nf6F9kcpc0EPC9VD;

1.1.1.1.2.1
date	2018.04.15.19.32.47;	author pgoyette;	state dead;
branches;
next	1.1.1.1.2.2;
commitid	W6xykws0Zbl4kpzA;

1.1.1.1.2.2
date	2018.04.22.07.20.09;	author pgoyette;	state Exp;
branches;
next	;
commitid	W6xykws0Zbl4kpzA;

1.1.1.1.4.1
date	2019.06.10.21.44.46;	author christos;	state Exp;
branches;
next	1.1.1.1.4.2;
commitid	jtc8rnCzWiEEHGqB;

1.1.1.1.4.2
date	2020.04.08.14.04.04;	author martin;	state Exp;
branches;
next	;
commitid	Qli2aW9E74UFuA3C;


desc
@@


1.1
log
@Initial revision
@
text
@#------------------------------------------------------------------------------
# $File: zip,v 1.1 2017/11/03 23:36:17 christos Exp $
# zip:  file(1) magic for zip files; this is not use
# Note the version of magic in archive is currently stronger, this is
# just an example until negative offsets are supported better

# Zip Central Cirectory record
0	name		zipcd
>0	string		PK\001\002
>>4	leshort		x		\b, made by
>>4	use		zipversion
>>6	leshort		x		\b, extract using at least
>>6	use		zipversion
>>12	ledate		x		\b, last modified %s
>>24	lelong		>0		\b, uncompressed size %d
>>10	leshort		x		\b, method=
>>10	use		zipcompression

# Zip known compressions
0	name		zipcompression
>0	leshort		0		\bstore
>0	leshort		8		\bdeflate
>0	leshort		9		\bdeflate64
>0	leshort		12		\bbzip2
>0	leshort		14		\blzma
>0	leshort		94		\bMP3
>0	leshort		95		\bxz
>0	leshort		96		\bJpeg
>0	leshort		97		\bWavPack
>0	leshort		98		\bPPMd
>0	leshort		99		\bAES Encrypted
>0	default		x
>>0	leshort		x		\b[%#x]

# Zip known versions
0	name		zipversion
>0	leshort		0x09		v0.9
>0	leshort		0x0a		v1.0
>0	leshort		0x0b		v1.1
>0	leshort		0x14		v2.0
>0	leshort		0x15		v2.1
>0	leshort		0x19		v2.5
>0	leshort		0x1b		v2.7
>0	leshort		0x2d		v4.5
>0	leshort		0x2e		v4.6
>0	leshort		0x32		v5.0
>0	leshort		0x33		v5.1
>0	leshort		0x34		v5.2
>0	leshort		0x3d		v6.1
>0	leshort		0x3e		v6.2
>0	leshort		0x3f		v6.3
>0	default		x
>>0	leshort		x		v?[%#x]

# Zip End Of Central Directory record
-22	string		PK\005\006	Zip archive data
#>4	leshort		>1		\b, %d disks
#>6	leshort		>1		\b, central directory disk %d
#>8	leshort		>1		\b, %d central directories on this disk
#>10	leshort		>1		\b, %d central directories
#>12	lelong		x		\b, %d central directory bytes
>(16.l)	use		zipcd
>20	pstring/l	>0		\b, %s
@


1.1.1.1
log
@2018-04-15  14:52  Christos Zoulas <christos@@zoulas.com>

	* release 5.33

2018-02-24  14:50  Christos Zoulas <christos@@zoulas.com>

	* extend the support for ${x?:} expansions for magic descriptions

2018-02-21  16:25  Christos Zoulas <christos@@zoulas.com>

	* add support for ${x?:} in mime types to handle
	  pie binaries.

2017-11-03   9:23  Christos Zoulas <christos@@zoulas.com>

	* add support for negative offsets (offsets from the end of file)

2017-09-26   8:22  Christos Zoulas <christos@@zoulas.com>

	* close the file on error when writing magic (Steve Grubb)

2017-09-24  12:02  Christos Zoulas <christos@@zoulas.com>

	* seccomp support (Paul Moore)

2017-09-02  11:53  Christos Zoulas <christos@@zoulas.com>

	* release 5.32

2017-08-28  16:37  Christos Zoulas <christos@@zoulas.com>

	* Always reset state in {file,buffer}_apprentice (Krzysztof Wilczynski)

2017-08-27  03:55  Christos Zoulas <christos@@zoulas.com>

	* Fix always true condition (Thomas Jarosch)

2017-05-24  17:30  Christos Zoulas <christos@@zoulas.com>

	* pickier parsing of numeric values in magic files.

2017-05-23  17:55  Christos Zoulas <christos@@zoulas.com>

	* PR/615 add magic_getflags()
@
text
@@


1.1.1.1.4.1
log
@Sync with HEAD
@
text
@d2 1
a2 1
# $File: zip,v 1.2 2019/04/09 18:34:15 christos Exp $
d9 1
a9 1
>0	string		PK\001\002	Zip archive data
d56 1
a56 1
-22	string		PK\005\006
@


1.1.1.1.4.2
log
@Merge changes from current as of 20200406
@
text
@d2 1
a2 1
# $File: zip,v 1.3 2019/07/06 19:25:06 christos Exp $
d63 1
a63 1
>>20	pstring/l	>0		\b, %s
@


1.1.1.2
log
@2019-05-14  22:26  Christos Zoulas <christos@@zoulas.com>

	* release 5.37

2019-05-09  22:27  Christos Zoulas <christos@@zoulas.com>

	* Make sure that continuation separators are printed
	  with -k within softmagic

2019-05-06  22:27  Christos Zoulas <christos@@zoulas.com>

	* Change SIGPIPE saving and restoring during compression to use
	  sigaction(2) instead of signal(3) and cache it. (Denys Vlasenko)
	* Cache stat(2) calls more to reduce number of calls (Denys Vlasenko)

2019-05-06  17:25  Christos Zoulas <christos@@zoulas.com>

	* PR/77: Handle --mime-type and -k correctly.

2019-05-03  15:26  Christos Zoulas <christos@@zoulas.com>

	* Switch decompression code to use vfork() because
	  tools like rpmdiff and rpmbuild call libmagic
	  with large process footprints (Denys Vlasenko)

2019-04-07  14:05  Christos Zoulas <christos@@zoulas.com>

	* PR/75: --enable-zlib, did not work.

2019-02-27  11:54  Christos Zoulas <christos@@zoulas.com>

	* Improve regex efficiency (Michael Schroeder) by:
		1. Prefixing regex searches with regular search
		   for keywords where possible
		2. Using memmem(3) where available
@
text
@d2 1
a2 1
# $File: zip,v 1.2 2019/04/09 18:34:15 christos Exp $
d9 1
a9 1
>0	string		PK\001\002	Zip archive data
d56 1
a56 1
-22	string		PK\005\006
@


1.1.1.3
log
@Import 5.38:
	- Always accept -S (no sandbox) even if we don't support sandboxing
	- More syscalls elided for sandboxiing
	- For ELF dynamic means having an interpreter not just PT_DYNAMIC
	- Check for large ELF session header offset
	- When saving and restoring a locale, keep the locale name in our
	  own storage.
	- Add a flag to disable CSV file detection.
	- Don't pass NULL/0 to memset to appease sanitizers.
	- Avoid spurious prints when looks for extensions or apple strings
	  in fsmagic.
	- Add builtin decompressors for xz and and bzip.
	- Add a limit for the number of CDF elements.
	- More checks for overflow in CDF.
@
text
@d2 1
a2 1
# $File: zip,v 1.3 2019/07/06 19:25:06 christos Exp $
d63 1
a63 1
>>20	pstring/l	>0		\b, %s
@


1.1.1.4
log
@Import 5.39:

   * Remove unused subtype_mime (Steve Grubb)
   * Remove unused check in okstat (Steve Grubb)
   * Fix mime-type in elf binaries by making sure $x is set
   * Fix indirect negative offsets broken by OFFNEGATIVE
   * Fix GUID equality check
   * PR/165: Handle empty array and strings in JSON
   * PR/162: Add --exclude-quiet
   * Fix memory leak in ascmagic (Steve Grubb)
   * Fix string comparison length with ignore whitespace
   * Fix mingwin 64 compilation
   * PR/159: whitelist getpid needed for file_pipe2file()
   * Indicate negative offsets with a flag OFFNEGATIVE
     so that -0 works.
   * Introduce "offset" magic type that can be used to
     detect the file size, and bail on short files.
   * document DER better in the magic man page.
   * fix memory leaks (SonarQube)
   * rewrite confusing loops (SonarQube)
   * fix bogus test (SonarQube)
   * pass a sized buffer to file_fmttime() (SonarQube)
   * Don't allow * in printf formats, or the code itself (Christoph Biedl)
   * Introduce a printf output size checker to avoid DoS attacks
   * Avoid memory leak on error (oss-fuzz)
   * Check length of string on DER before derefercing and add new types
   * Add missing DER string (oss-fuzz)
   * Add missing DER types, and debugging
   * PR/140: Avoid abort with hand-crafted magic file (gockelhahn)
   * PR/139:  Avoid DoS in printf with hand-crafted magic file (gockelhahn)
   * PR/138: Avoid crash with hand-crafted magic file (gockelhahn)
   * PR/136: Fix static build by adding a libmagic.pc (Fabrice Fontaine)
   * add guid support native support via the "guid" type.
@
text
@d2 1
a2 1
# $File: zip,v 1.4 2020/03/03 13:46:52 christos Exp $
d7 1
a7 1
# Zip Central Directory record
a11 1
>>4	use		ziphost
a18 2
# URL:		https://en.wikipedia.org/wiki/Zip_(file_format)
# reference:	https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.6.TXT
a21 3
>0	leshort		1		\bShrinking
>0	leshort		6		\bImploding
>0	leshort		7		\bTokenizing
a23 2
>0	leshort		10		\bLibrary imploding
#>0	leshort		11 		\bReserved by PKWARE
a24 1
#>0	leshort		13 		\bReserved by PKWARE
a25 6
#>0	leshort		15 		\bReserved by PKWARE
>0	leshort		16		\bCMPSC Compression
#>0	leshort		17 		\bReserved by PKWARE
>0	leshort		18		\bIBM TERSE
>0	leshort		19		\bIBM LZ77
# https://support.winzip.com/hc/en-us/articles/115012122828-Compression-method-used-for-this-file-is-94
d37 17
a53 49
# The lower byte indicates the ZIP version of this file. The value/10 indicates
# the major version number, and the value mod 10 is the minor version number.
>0	ubyte/10	x		v%u
>0	ubyte%10	x		\b.%u
# >0	leshort		0x09		v0.9
# >0	leshort		0x0a		v1.0
# >0	leshort		0x0b		v1.1
# >0	leshort		0x14		v2.0
# >0	leshort		0x15		v2.1
# >0	leshort		0x19		v2.5
# >0	leshort		0x1b		v2.7
# >0	leshort		0x2d		v4.5
# >0	leshort		0x2e		v4.6
# >0	leshort		0x32		v5.0
# >0	leshort		0x33		v5.1
# >0	leshort		0x34		v5.2
# >0	leshort		0x3d		v6.1
# >0	leshort		0x3e		v6.2
# >0	leshort		0x3f		v6.3
# >0	default		x
# >>0	leshort		x		v?[%#x]

#	display compatible host system name of ZIP archive
0	name		ziphost
# The upper byte indicates the compatibility of the file attribute information.
# If the file is compatible with MS-DOS (v 2.04g) then this value will be zero.
#>1	ubyte		0		DOS
>1	ubyte		1 		Amiga
>1	ubyte		2		OpenVMS
>1	ubyte		3		UNIX
>1	ubyte		4		VM/CMS
>1	ubyte		6		OS/2
>1	ubyte		7		Macintosh
>1	ubyte		11		MVS
>1	ubyte		13		Acorn Risc
>1	ubyte		16		BeOS
>1	ubyte		17		Tandem
# 9 untested
>1	ubyte		5		Atari ST
>1	ubyte		8		Z-System
>1	ubyte		9		CP/M
>1	ubyte		10		Windows NTFS
>1	ubyte		12		VSE
>1	ubyte		14		VFAT
>1	ubyte		15		alternate MVS
>1	ubyte		18		OS/400
>1	ubyte		19		OS X
# unused
#>1	ubyte		>19		unused 0x%x
@


1.1.1.5
log
@2021-03-30  20:21  Christos Zoulas <christos@@zoulas.com>

	* release 5.40

2021-02-05  16:31  Christos Zoulas <christos@@zoulas.com>

	* PR/234: Add limit to the number of bytes to scan for encoding
	* PR/230: Fix /T (trim flag) for regex

2021-02-01  12:31  Christos Zoulas <christos@@zoulas.com>
	* PR/77: Trim trailing separator.

2020-12-17  15:44  Christos Zoulas <christos@@zoulas.com>

	* PR/211: Convert system read errors from corrupt ELF
	  files into human readable error messages

2020-12-08  16:24  Christos Zoulas <christos@@zoulas.com>

	* fix multithreaded decompression file descriptor issue
	  by using close-on-exec (Denys Vlasenko)

2020-06-27  11:58  Christos Zoulas <christos@@zoulas.com>

	* Exclude surrogate pairs from utf-8 detection (Michael Liu)

2020-06-25  12:53  Christos Zoulas <christos@@zoulas.com>

	* Include # to the list of ignored format chars (Werner Fink)
@
text
@d2 1
a2 1
# $File: zip,v 1.6 2021/02/05 22:55:36 christos Exp $
a9 1
!:mime	application/zip
d21 1
a21 1
# reference:	https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT (Version: 6.3.9)
d36 1
a36 1
>0	leshort		16		\bCMPSC (IBM z/OS)
d39 2
a40 3
>0	leshort		19		\bIBM LZ77 (z/Architecture)
>0	leshort		20		\bZstd (deprecated)
>0	leshort		93		\bZstd
@


1.1.1.6
log
@Import file-5.43+; last was file-5.40

2022-09-20  17:12  Christos Zoulas <christos@@zoulas.com>

	* fixed various clustefuzz issues

2022-09-19  15:54  Christos Zoulas <christos@@zoulas.com>

	* Fix error detection for decompression code (Vincent Mihalkovic)

2022-09-15  13:50  Christos Zoulas <christos@@zoulas.com>

	* Add MAGIC_NO_COMPRESS_FORK and use it to produce a more
	  meaningful error message if we are sandboxing.

2022-09-15  10:45  Christos Zoulas <christos@@zoulas.com>

	* Add built-in lzip decompression support (Michal Gorny)

2022-09-14  10:35  Christos Zoulas <christos@@zoulas.com>

	* Add built-in zstd decompression support (Martin Rodriguez Reboredo)

2022-09-13  14:55  Christos Zoulas <christos@@zoulas.com>

	* release 5.43

2022-09-10   9:17  Christos Zoulas <christos@@zoulas.com>

	* Add octal indirect magic (Michal Gorny)

2022-08-17  11:43  Christos Zoulas <christos@@zoulas.com>

	* PR/374: avoid infinite loop in non-wide code (piru)
	* PR/373: Obey MAGIC_CONTINUE with multiple magic files (vismarli)

2022-07-26  11:10  Christos Zoulas <christos@@zoulas.com>

	* Fix bug with large flist (Florian Weimer)

2022-07-07  13:21  Christos Zoulas <christos@@zoulas.com>

        * PR/364: Detect non-nul-terminated core filenames from QEMU
	  (mam-ableton)

2022-07-04  15:45  Christos Zoulas <christos@@zoulas.com>

	* PR/359: Add support for http://ndjson.org/ (darose)
	* PR/362: Fix wide printing (ro-ee)
	* PR/358: Fix width for -f - (jpalus)
	* PR/356: Fix JSON constant parsing (davewhite)

2022-06-10   9:40  Christos Zoulas <christos@@zoulas.com>

	* release 5.42

2022-05-31  14:50   Christos Zoulas <christos@@zoulas.com>

	* PR/348: add missing cases to prevent file from aborting on
	  random magic files.

2022-05-27  21:05   Christos Zoulas <christos@@zoulas.com>

	* PR/351: octalify filenames when not raw before printing.

2022-04-18  17:51   Christos Zoulas <christos@@zoulas.com>

	* fix regex cacheing bug (Dirk Mueller)
	* merge file_regcomp and file_regerror() to simplify the code
	  and reduce memory requirements for storing regexes (Dirk Mueller)

2022-03-19  12:56   Christos Zoulas <christos@@zoulas.com>

	* cache regex (Dirk Mueller)
	* detect filesystem full by flushing output (Dirk Mueller)

2021-11-19  12:36   Christos Zoulas <christos@@zoulas.com>

	* implement running decompressor programs using
	  posix_spawnp(2) instead of vfork(2)

2021-10-24  11:51   Christos Zoulas <christos@@zoulas.com>

	* Add support for msdos dates and times

2021-10-20   9:55   Christos Zoulas <christos@@zoulas.com>

	* use the system byte swapping functions if available (Werner Fink)

2021-10-18  11:57  Christos Zoulas <christos@@zoulas.com>

	* release 5.41

2021-09-23  03:51  Christos Zoulas <christos@@zoulas.com>

	* Avinash Sonawane: Fix tzname detection

2021-09-03  09:17  Christos Zoulas <christos@@zoulas.com>

	* Fix relationship tests with "search" magic, don't short circuit
	  logic

2021-07-13  01:06  Christos Zoulas <christos@@zoulas.com>

	* Fix memory leak in compile mode

2021-07-01  03:51  Christos Zoulas <christos@@zoulas.com>

	* PR/272: kiefermat: Only set returnval = 1 when we printed something
	  (in all cases print or !print). This simplifies the logic and fixes
	  the issue in the PR with -k and --mime-type there was no continuation
	  printed before the default case.

2021-06-30  13:07  Christos Zoulas <christos@@zoulas.com>

	* PR/270: Don't translate unprintable characters in %s magic formats
	  when -r
	* PR/269: Avoid undefined behavior with clang (adding offset to NULL)

2021-05-09  18:38  Christos Zoulas <christos@@zoulas.com>

	* Add a new flag (f) that requires that the match is a full word,
	   not a partial word match.
	* Add varint types (unused)

2021-04-19  17:17  Christos Zoulas <christos@@zoulas.com>

	* PR/256: mutableVoid: If the file is less than 3 bytes, use the file
	  length to determine type
	* PR/259: aleksandr.v.novichkov: mime printing through indirect magic
	  is not taken into account, use match directly so that it does.

2021-04-04  17:02  Christos Zoulas <christos@@zoulas.com>

	* count the total bytes found not the total byte positions
	  in order to determine encoding (Anatol Belski)
@
text
@d2 1
a2 1
# $File: zip,v 1.8 2021/10/24 15:53:56 christos Exp $
a5 1
# Note:	All fields unless otherwise noted are unsigned!
a10 1
# no "made by" in local file header with PK\3\4 magic
a13 1
# inside ./archive 1.151 called "at least" zipversion "to extract"
d16 2
a17 7
# This is DOS date like: ledate 21:00:48 19 Dec 2001 != DOS 00:00 1 Jan 2010 ~ 0000213C
>>12	ulelong		x		\b, last modified
>>14	lemsdosdate	x		\b, last modified %s
>>12	lemsdostime	x		%s
# uncompressed size of 1st entry; FFffFFff means real value stored in ZIP64 record
>>24	ulelong		!0xFFffFFff	\b, uncompressed size %u
# inside ./archive 1.151 called "compression method="zipcompression
d102 1
a102 1
#>1	ubyte		>19		unused %#x
a104 1
# GRR: wrong for ZIP with comment archive
d106 5
a110 7
#>4	uleshort	!0xFFff		\b, %u disks
#>6	uleshort	!0xFFff		\b, central directory disk %u
#>8	uleshort	!0xFFff		\b, %u central directories on this disk
#>10	uleshort	!0xFFff		\b, %u central directories
#>12	ulelong		!0xFFffFFff	\b, %u central directory bytes
# offset of central directory
#>16	ulelong		x		\b, central directory offset %#x
a111 3
# archive comment length n
#>>20	uleshort	>0		\b, comment length %u
# archive comment
@


1.1.1.1.2.1
log
@file zip was added on branch pgoyette-compat on 2018-04-22 07:20:09 +0000
@
text
@d1 63
@


1.1.1.1.2.2
log
@Sync with HEAD
@
text
@a0 63
#------------------------------------------------------------------------------
# $File: zip,v 1.1 2017/11/03 23:36:17 christos Exp $
# zip:  file(1) magic for zip files; this is not use
# Note the version of magic in archive is currently stronger, this is
# just an example until negative offsets are supported better

# Zip Central Cirectory record
0	name		zipcd
>0	string		PK\001\002
>>4	leshort		x		\b, made by
>>4	use		zipversion
>>6	leshort		x		\b, extract using at least
>>6	use		zipversion
>>12	ledate		x		\b, last modified %s
>>24	lelong		>0		\b, uncompressed size %d
>>10	leshort		x		\b, method=
>>10	use		zipcompression

# Zip known compressions
0	name		zipcompression
>0	leshort		0		\bstore
>0	leshort		8		\bdeflate
>0	leshort		9		\bdeflate64
>0	leshort		12		\bbzip2
>0	leshort		14		\blzma
>0	leshort		94		\bMP3
>0	leshort		95		\bxz
>0	leshort		96		\bJpeg
>0	leshort		97		\bWavPack
>0	leshort		98		\bPPMd
>0	leshort		99		\bAES Encrypted
>0	default		x
>>0	leshort		x		\b[%#x]

# Zip known versions
0	name		zipversion
>0	leshort		0x09		v0.9
>0	leshort		0x0a		v1.0
>0	leshort		0x0b		v1.1
>0	leshort		0x14		v2.0
>0	leshort		0x15		v2.1
>0	leshort		0x19		v2.5
>0	leshort		0x1b		v2.7
>0	leshort		0x2d		v4.5
>0	leshort		0x2e		v4.6
>0	leshort		0x32		v5.0
>0	leshort		0x33		v5.1
>0	leshort		0x34		v5.2
>0	leshort		0x3d		v6.1
>0	leshort		0x3e		v6.2
>0	leshort		0x3f		v6.3
>0	default		x
>>0	leshort		x		v?[%#x]

# Zip End Of Central Directory record
-22	string		PK\005\006	Zip archive data
#>4	leshort		>1		\b, %d disks
#>6	leshort		>1		\b, central directory disk %d
#>8	leshort		>1		\b, %d central directories on this disk
#>10	leshort		>1		\b, %d central directories
#>12	lelong		x		\b, %d central directory bytes
>(16.l)	use		zipcd
>20	pstring/l	>0		\b, %s
@


