head	1.1;
branch	1.1.1;
access;
symbols
	FILE5_48:1.1.1.13
	netbsd-11-0-RC4:1.1.1.12
	netbsd-11-0-RC3:1.1.1.12
	netbsd-11-0-RC2:1.1.1.12
	netbsd-11-0-RC1:1.1.1.12
	perseant-exfatfs-base-20250801:1.1.1.12
	netbsd-11:1.1.1.12.0.4
	netbsd-11-base:1.1.1.12
	netbsd-10-1-RELEASE:1.1.1.11
	perseant-exfatfs-base-20240630:1.1.1.12
	perseant-exfatfs:1.1.1.12.0.2
	perseant-exfatfs-base:1.1.1.12
	netbsd-8-3-RELEASE:1.1.1.5
	netbsd-9-4-RELEASE:1.1.1.8
	netbsd-10-0-RELEASE:1.1.1.11
	netbsd-10-0-RC6:1.1.1.11
	netbsd-10-0-RC5:1.1.1.11
	netbsd-10-0-RC4:1.1.1.11
	netbsd-10-0-RC3:1.1.1.11
	netbsd-10-0-RC2:1.1.1.11
	netbsd-10-0-RC1:1.1.1.11
	FILE5_45:1.1.1.12
	netbsd-10:1.1.1.11.0.2
	netbsd-10-base:1.1.1.11
	FILE5_43:1.1.1.11
	netbsd-9-3-RELEASE:1.1.1.8
	cjep_sun2x-base1:1.1.1.10
	cjep_sun2x:1.1.1.10.0.4
	cjep_sun2x-base:1.1.1.10
	cjep_staticlib_x-base1:1.1.1.10
	netbsd-9-2-RELEASE:1.1.1.8
	cjep_staticlib_x:1.1.1.10.0.2
	cjep_staticlib_x-base:1.1.1.10
	FILE5_40:1.1.1.10
	netbsd-9-1-RELEASE:1.1.1.8
	FILE5_39:1.1.1.9
	phil-wifi-20200421:1.1.1.9
	phil-wifi-20200411:1.1.1.9
	is-mlppp:1.1.1.9.0.2
	is-mlppp-base:1.1.1.9
	phil-wifi-20200406:1.1.1.9
	netbsd-8-2-RELEASE:1.1.1.5
	netbsd-9-0-RELEASE:1.1.1.8
	netbsd-9-0-RC2:1.1.1.8
	FILE5_38:1.1.1.9
	netbsd-9-0-RC1:1.1.1.8
	phil-wifi-20191119:1.1.1.8
	netbsd-9:1.1.1.8.0.2
	netbsd-9-base:1.1.1.8
	phil-wifi-20190609:1.1.1.8
	netbsd-8-1-RELEASE:1.1.1.5
	FILE5_37:1.1.1.8
	netbsd-8-1-RC1:1.1.1.5
	pgoyette-compat-merge-20190127:1.1.1.5.14.2
	pgoyette-compat-20190127:1.1.1.7
	pgoyette-compat-20190118:1.1.1.7
	pgoyette-compat-1226:1.1.1.7
	pgoyette-compat-1126:1.1.1.7
	pgoyette-compat-1020:1.1.1.7
	FILE5_35:1.1.1.7
	pgoyette-compat-0930:1.1.1.6
	pgoyette-compat-0906:1.1.1.6
	netbsd-7-2-RELEASE:1.1.1.4
	pgoyette-compat-0728:1.1.1.6
	netbsd-8-0-RELEASE:1.1.1.5
	phil-wifi:1.1.1.6.0.2
	phil-wifi-base:1.1.1.6
	pgoyette-compat-0625:1.1.1.6
	netbsd-8-0-RC2:1.1.1.5
	pgoyette-compat-0521:1.1.1.6
	pgoyette-compat-0502:1.1.1.6
	pgoyette-compat-0422:1.1.1.6
	netbsd-8-0-RC1:1.1.1.5
	FILE5_33:1.1.1.6
	pgoyette-compat-0415:1.1.1.5
	pgoyette-compat-0407:1.1.1.5
	pgoyette-compat-0330:1.1.1.5
	pgoyette-compat-0322:1.1.1.5
	pgoyette-compat-0315:1.1.1.5
	netbsd-7-1-2-RELEASE:1.1.1.4
	pgoyette-compat:1.1.1.5.0.14
	pgoyette-compat-base:1.1.1.5
	netbsd-7-1-1-RELEASE:1.1.1.4
	matt-nb8-mediatek:1.1.1.5.0.12
	matt-nb8-mediatek-base:1.1.1.5
	FILE5_32:1.1.1.5
	perseant-stdc-iso10646:1.1.1.5.0.10
	perseant-stdc-iso10646-base:1.1.1.5
	netbsd-8:1.1.1.5.0.8
	netbsd-8-base:1.1.1.5
	FILE5_31:1.1.1.5
	prg-localcount2-base3:1.1.1.5
	prg-localcount2-base2:1.1.1.5
	prg-localcount2-base1:1.1.1.5
	prg-localcount2:1.1.1.5.0.6
	prg-localcount2-base:1.1.1.5
	pgoyette-localcount-20170426:1.1.1.5
	bouyer-socketcan-base1:1.1.1.5
	pgoyette-localcount-20170320:1.1.1.5
	netbsd-7-1:1.1.1.4.0.8
	netbsd-7-1-RELEASE:1.1.1.4
	netbsd-7-1-RC2:1.1.1.4
	FILE5_30:1.1.1.5
	netbsd-7-nhusb-base-20170116:1.1.1.4
	bouyer-socketcan:1.1.1.5.0.4
	bouyer-socketcan-base:1.1.1.5
	pgoyette-localcount-20170107:1.1.1.5
	netbsd-7-1-RC1:1.1.1.4
	pgoyette-localcount-20161104:1.1.1.5
	netbsd-7-0-2-RELEASE:1.1.1.4
	localcount-20160914:1.1.1.5
	netbsd-7-nhusb:1.1.1.4.0.6
	netbsd-7-nhusb-base:1.1.1.4
	pgoyette-localcount-20160806:1.1.1.5
	pgoyette-localcount-20160726:1.1.1.5
	pgoyette-localcount:1.1.1.5.0.2
	pgoyette-localcount-base:1.1.1.5
	netbsd-7-0-1-RELEASE:1.1.1.4
	netbsd-7-0:1.1.1.4.0.4
	netbsd-7-0-RELEASE:1.1.1.4
	netbsd-7-0-RC3:1.1.1.4
	netbsd-7-0-RC2:1.1.1.4
	netbsd-7-0-RC1:1.1.1.4
	FILE5_22:1.1.1.5
	FILE5_20:1.1.1.5
	netbsd-6-0-6-RELEASE:1.1.1.1
	netbsd-6-1-5-RELEASE:1.1.1.1
	netbsd-7:1.1.1.4.0.2
	netbsd-7-base:1.1.1.4
	FILE5_19:1.1.1.4
	yamt-pagecache-base9:1.1.1.3
	yamt-pagecache-tag8:1.1.1.1
	netbsd-6-1-4-RELEASE:1.1.1.1
	netbsd-6-0-5-RELEASE:1.1.1.1
	tls-earlyentropy:1.1.1.3.0.2
	tls-earlyentropy-base:1.1.1.4
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.3
	riastradh-drm2-base3:1.1.1.3
	netbsd-6-1-3-RELEASE:1.1.1.1
	netbsd-6-0-4-RELEASE:1.1.1.1
	FILE5_16:1.1.1.3
	netbsd-6-1-2-RELEASE:1.1.1.1
	netbsd-6-0-3-RELEASE:1.1.1.1
	netbsd-6-1-1-RELEASE:1.1.1.1
	riastradh-drm2-base2:1.1.1.2
	riastradh-drm2-base1:1.1.1.2
	riastradh-drm2:1.1.1.2.0.6
	riastradh-drm2-base:1.1.1.2
	netbsd-6-1:1.1.1.1.0.16
	netbsd-6-0-2-RELEASE:1.1.1.1
	netbsd-6-1-RELEASE:1.1.1.1
	khorben-n900:1.1.1.2.0.4
	netbsd-6-1-RC4:1.1.1.1
	netbsd-6-1-RC3:1.1.1.1
	agc-symver:1.1.1.2.0.2
	agc-symver-base:1.1.1.2
	FILE5_14:1.1.1.2
	netbsd-6-1-RC2:1.1.1.1
	netbsd-6-1-RC1:1.1.1.1
	yamt-pagecache-base8:1.1.1.1
	FILE_5_12:1.1.1.1
	netbsd-6-0-1-RELEASE:1.1.1.1
	yamt-pagecache-base7:1.1.1.1
	matt-nb6-plus-nbase:1.1.1.1
	yamt-pagecache-base6:1.1.1.1
	netbsd-6-0:1.1.1.1.0.12
	netbsd-6-0-RELEASE:1.1.1.1
	netbsd-6-0-RC2:1.1.1.1
	tls-maxphys:1.1.1.1.0.10
	tls-maxphys-base:1.1.1.4
	matt-nb6-plus:1.1.1.1.0.8
	matt-nb6-plus-base:1.1.1.1
	netbsd-6-0-RC1:1.1.1.1
	yamt-pagecache-base5:1.1.1.1
	yamt-pagecache-base4:1.1.1.1
	FILE5_11:1.1.1.1
	netbsd-6:1.1.1.1.0.6
	netbsd-6-base:1.1.1.1
	yamt-pagecache-base3:1.1.1.1
	yamt-pagecache-base2:1.1.1.1
	yamt-pagecache:1.1.1.1.0.4
	yamt-pagecache-base:1.1.1.1
	FILE5_09:1.1.1.1
	cherry-xenmp:1.1.1.1.0.2
	cherry-xenmp-base:1.1.1.1
	FILE5_07:1.1.1.1
	CHRISTOS:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2011.05.12.20.47.03;	author christos;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2011.05.12.20.47.03;	author christos;	state Exp;
branches
	1.1.1.1.4.1
	1.1.1.1.10.1;
next	1.1.1.2;

1.1.1.2
date	2013.03.23.15.49.18;	author christos;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2013.12.01.19.28.19;	author christos;	state Exp;
branches
	1.1.1.3.2.1;
next	1.1.1.4;
commitid	RVQIxe3FpM3lSsfx;

1.1.1.4
date	2014.06.13.01.48.25;	author christos;	state Exp;
branches;
next	1.1.1.5;
commitid	jtTYsE5FmJU6MiEx;

1.1.1.5
date	2014.10.10.20.08.22;	author christos;	state Exp;
branches
	1.1.1.5.14.1;
next	1.1.1.6;
commitid	pfOzhE33qnut2HTx;

1.1.1.6
date	2018.04.15.19.32.47;	author christos;	state Exp;
branches
	1.1.1.6.2.1;
next	1.1.1.7;
commitid	unKSwpX2g9VqBzyA;

1.1.1.7
date	2018.10.18.23.54.09;	author christos;	state Exp;
branches;
next	1.1.1.8;
commitid	e8WctwerBeEm4vWA;

1.1.1.8
date	2019.05.22.17.19.57;	author christos;	state Exp;
branches;
next	1.1.1.9;
commitid	VXeNRYYruN1MWdoB;

1.1.1.9
date	2019.12.17.02.23.53;	author christos;	state Exp;
branches;
next	1.1.1.10;
commitid	vqYTz60fS9PNg0PB;

1.1.1.10
date	2021.04.09.18.58.02;	author christos;	state Exp;
branches;
next	1.1.1.11;
commitid	W9ddLLbSkHHinEOC;

1.1.1.11
date	2022.09.24.20.07.54;	author christos;	state Exp;
branches;
next	1.1.1.12;
commitid	Nf6F9kcpc0EPC9VD;

1.1.1.12
date	2023.08.18.18.36.51;	author christos;	state Exp;
branches;
next	1.1.1.13;
commitid	IX26ghc1E2S0AiBE;

1.1.1.13
date	2026.06.10.15.59.14;	author christos;	state Exp;
branches;
next	;
commitid	3UWc0DrzTz7bHgJG;

1.1.1.1.4.1
date	2014.05.22.15.44.59;	author yamt;	state Exp;
branches;
next	;
commitid	tYJXbWAuFvTh7yBx;

1.1.1.1.10.1
date	2013.06.23.06.26.32;	author tls;	state Exp;
branches;
next	1.1.1.1.10.2;
commitid	OnlO1cBgtQRcIHUw;

1.1.1.1.10.2
date	2014.08.19.23.46.47;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.3.2.1
date	2014.08.10.07.07.10;	author tls;	state Exp;
branches;
next	;
commitid	b1wUlsZGswrdGMLx;

1.1.1.5.14.1
date	2018.04.22.07.20.08;	author pgoyette;	state Exp;
branches;
next	1.1.1.5.14.2;
commitid	W6xykws0Zbl4kpzA;

1.1.1.5.14.2
date	2018.10.20.06.58.20;	author pgoyette;	state Exp;
branches;
next	;
commitid	mTSoqZEZ4arHnFWA;

1.1.1.6.2.1
date	2019.06.10.21.44.46;	author christos;	state Exp;
branches;
next	1.1.1.6.2.2;
commitid	jtc8rnCzWiEEHGqB;

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


desc
@@


1.1
log
@Initial revision
@
text
@
#------------------------------------------------------------------------------
# $File: msooxml,v 1.1 2011/01/25 18:36:19 christos Exp $
# msooxml:  file(1) magic for Microsoft Office XML
# From: Ralf Brown <ralf.brown@@gmail.com>

# .docx, .pptx, and .xlsx are XML plus other files inside a ZIP
#   archive.  The first member file is normally "[Content_Types].xml".
# Since MSOOXML doesn't have anything like the uncompressed "mimetype"
#   file of ePub or OpenDocument, we'll have to scan for a filename
#   which can distinguish between the three types

# start by checking for ZIP local file header signature
0               string          PK\003\004
# make sure the first file is correct
>0x1E           string          [Content_Types].xml
# skip to the second local file header
#   since some documents include a 520-byte extra field following the file
#   header,  we need to scan for the next header
>>(18.l+49)     search/2000     PK\003\004
# now skip to the *third* local file header; again, we need to scan due to a
#   520-byte extra field following the file header
>>>&26          search/1000     PK\003\004
# and check the subdirectory name to determine which type of OOXML
#   file we have
>>>>&26         string          word/           Microsoft Word 2007+
!:mime application/msword
>>>>&26         string          ppt/            Microsoft PowerPoint 2007+
!:mime application/vnd.ms-powerpoint
>>>>&26         string          xl/             Microsoft Excel 2007+
!:mime application/vnd.ms-excel
>>>>&26         default         x               Microsoft OOXML
!:strength +10
@


1.1.1.1
log
@from ftp.astron.com.
- many security related fixes
- no MAXPATHLEN limits
- fixed missing text specification on ascii magic
- new ``pascal'' style string formats
- whitespace comparison fix
- more magic
@
text
@@


1.1.1.1.4.1
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@d3 1
a3 1
# $File: msooxml,v 1.3 2013/09/12 16:08:07 christos Exp $
a8 2
#   but some libreoffice generated files put this later. Perhaps skip
#   the "[Content_Types].xml" test?
d14 1
a14 2
0		string		PK\003\004
!:strength +10
d16 1
a16 6
>0x1E		string		[Content_Types].xml
>>0		use		msooxml
>0xE84		string		[Content_Types].xml
>>0		use		msooxml

0		name		msooxml
d18 3
a20 3
# since some documents include a 520-byte extra field following the file
# header, we need to scan for the next header
>(18.l+49)	search/2000	PK\003\004
d22 2
a23 2
# 520-byte extra field following the file header
>>&26		search/1000	PK\003\004
d25 9
a33 9
# file we have.  Correct the mimetype with the registered ones:
# http://technet.microsoft.com/en-us/library/cc179224.aspx
>>>&26		string		word/		Microsoft Word 2007+
!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
>>>&26		string		ppt/		Microsoft PowerPoint 2007+
!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
>>>&26		string		xl/		Microsoft Excel 2007+
!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
>>>&26		default		x		Microsoft OOXML
@


1.1.1.1.10.1
log
@resync from head
@
text
@d3 1
a3 1
# $File: msooxml,v 1.2 2013/01/25 23:04:37 christos Exp $
a25 2
#   Correct the mimetype with the registered ones:
#     http://technet.microsoft.com/en-us/library/cc179224.aspx
d27 1
a27 1
!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
d29 1
a29 1
!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
d31 1
a31 1
!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
@


1.1.1.1.10.2
log
@Rebase to HEAD as of a few days ago.
@
text
@d3 1
a3 1
# $File: msooxml,v 1.4 2014/01/06 18:16:24 rrt Exp $
a8 2
#   but some libreoffice generated files put this later. Perhaps skip
#   the "[Content_Types].xml" test?
d14 1
a14 2
0		string		PK\003\004
!:strength +10
d16 1
a16 1
>0x1E		regex		\[Content_Types\]\.xml|_rels/\.rels
d18 3
a20 3
# since some documents include a 520-byte extra field following the file
# header, we need to scan for the next header
>>(18.l+49)	search/2000	PK\003\004
d22 2
a23 2
# 520-byte extra field following the file header
>>>&26		search/1000	PK\003\004
d25 4
a28 3
# file we have.  Correct the mimetype with the registered ones:
# http://technet.microsoft.com/en-us/library/cc179224.aspx
>>>>&26		string		word/		Microsoft Word 2007+
d30 1
a30 1
>>>>&26		string		ppt/		Microsoft PowerPoint 2007+
d32 1
a32 1
>>>>&26		string		xl/		Microsoft Excel 2007+
d34 2
a35 1
>>>>&26		default		x		Microsoft OOXML
@


1.1.1.2
log
@import file-5.14
changes are "name" + "use" keyword features, bug fixes
@
text
@d3 1
a3 1
# $File: msooxml,v 1.2 2013/01/25 23:04:37 christos Exp $
a25 2
#   Correct the mimetype with the registered ones:
#     http://technet.microsoft.com/en-us/library/cc179224.aspx
d27 1
a27 1
!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
d29 1
a29 1
!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
d31 1
a31 1
!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
@


1.1.1.3
log
@from ftp.astron.com, this is a bug fix release:
       * always leave magic file loaded, don't unload for magic_check, etc.
       * fix default encoding to binary instead of unknown which broke recently
       * handle empty and one byte files, less specially so that
         --mime-encoding does not break completely.
       * fix erroneous non-zero exit code from non-existant file and message
       * add CDF MSI file detection (Guy Helmer)
@
text
@d3 1
a3 1
# $File: msooxml,v 1.3 2013/09/12 16:08:07 christos Exp $
a8 2
#   but some libreoffice generated files put this later. Perhaps skip
#   the "[Content_Types].xml" test?
d14 1
a14 2
0		string		PK\003\004
!:strength +10
d16 1
a16 6
>0x1E		string		[Content_Types].xml
>>0		use		msooxml
>0xE84		string		[Content_Types].xml
>>0		use		msooxml

0		name		msooxml
d18 3
a20 3
# since some documents include a 520-byte extra field following the file
# header, we need to scan for the next header
>(18.l+49)	search/2000	PK\003\004
d22 2
a23 2
# 520-byte extra field following the file header
>>&26		search/1000	PK\003\004
d25 4
a28 3
# file we have.  Correct the mimetype with the registered ones:
# http://technet.microsoft.com/en-us/library/cc179224.aspx
>>>&26		string		word/		Microsoft Word 2007+
d30 1
a30 1
>>>&26		string		ppt/		Microsoft PowerPoint 2007+
d32 1
a32 1
>>>&26		string		xl/		Microsoft Excel 2007+
d34 2
a35 1
>>>&26		default		x		Microsoft OOXML
@


1.1.1.3.2.1
log
@Rebase.
@
text
@d3 1
a3 1
# $File: msooxml,v 1.4 2014/01/06 18:16:24 rrt Exp $
d19 6
a24 1
>0x1E		regex		\[Content_Types\]\.xml|_rels/\.rels
d28 1
a28 1
>>(18.l+49)	search/2000	PK\003\004
d31 1
a31 1
>>>&26		search/1000	PK\003\004
d35 1
a35 1
>>>>&26		string		word/		Microsoft Word 2007+
d37 1
a37 1
>>>>&26		string		ppt/		Microsoft PowerPoint 2007+
d39 1
a39 1
>>>>&26		string		xl/		Microsoft Excel 2007+
d41 1
a41 1
>>>>&26		default		x		Microsoft OOXML
@


1.1.1.4
log
@import file-5.19

2014-06-09   9:04  Christos Zoulas <christos@@zoulas.com>

	* Misc buffer overruns and missing buffer size tests in cdf parsing
	  (Francisco Alonso, Jan Kaluza)

2014-06-02  14:50  Christos Zoulas <christos@@zoulas.com>

	* Enforce limit of 8K on regex searches that have no limits
	* Allow the l modifier for regex to mean line count. Default
	  to byte count. If line count is specified, assume a max
	  of 80 characters per line to limit the byte count.
	* Don't allow conversions to be used for dates, allowing
	  the mask field to be used as an offset.

2014-05-30  12:51  Christos Zoulas <christos@@zoulas.com>

	* Make the range operator limit the length of the
	  regex search.

2014-05-14  19:23  Christos Zoulas <christos@@zoulas.com>

	* PR/347: Windows fixes
	* PR/352: Hangul word processor recognition
	* PR/354: Encoding irregularities in text files

2014-05-06  6:12  Christos Zoulas <christos@@zoulas.com>

	* Fix uninitialized title in CDF files (Jan Kaluza)

2014-05-04  14:55  Christos Zoulas <christos@@zoulas.com>

	* PR/351: Fix compilation of empty files

2014-04-30  17:39  Christos Zoulas <christos@@zoulas.com>

	* Fix integer formats: We don't specify 'l' or
	  'h' and 'hh' specifiers anymore, only 'll' for
	  quads and nothing for the rest. This is so that
	  magic writing is simpler.

2014-04-01  15:25  Christos Zoulas <christos@@zoulas.com>

	* PR/341: Jan Kaluza, fix memory leak
	* PR/342: Jan Kaluza, fix out of bounds read

2014-03-28  15:25  Christos Zoulas <christos@@zoulas.com>

	* Fix issue with long formats not matching fmtcheck
@
text
@d3 1
a3 1
# $File: msooxml,v 1.4 2014/01/06 18:16:24 rrt Exp $
d19 6
a24 1
>0x1E		regex		\[Content_Types\]\.xml|_rels/\.rels
d28 1
a28 1
>>(18.l+49)	search/2000	PK\003\004
d31 1
a31 1
>>>&26		search/1000	PK\003\004
d35 1
a35 1
>>>>&26		string		word/		Microsoft Word 2007+
d37 1
a37 1
>>>>&26		string		ppt/		Microsoft PowerPoint 2007+
d39 1
a39 1
>>>>&26		string		xl/		Microsoft Excel 2007+
d41 1
a41 1
>>>>&26		default		x		Microsoft OOXML
@


1.1.1.5
log
@import file-5.20; bug fixes and better image magic descriptions.
@
text
@d3 1
a3 1
# $File: msooxml,v 1.5 2014/08/05 07:38:45 christos Exp $
d19 1
a19 1
>0x1E		regex		\\[Content_Types\\]\\.xml|_rels/\\.rels
@


1.1.1.5.14.1
log
@Sync with HEAD
@
text
@d3 1
a3 1
# $File: msooxml,v 1.7 2018/03/12 12:38:59 christos Exp $
a14 8
0		name		msooxml
>0		string		word/		Microsoft Word 2007+
!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
>0		string		ppt/		Microsoft PowerPoint 2007+
!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
>0		string		xl/		Microsoft Excel 2007+
!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

d30 7
a36 6
>>>>&26		use		msooxml	
>>>>&26		default		x
# OpenOffice/Libreoffice orders ZIP entry differently, so check the 4th file
>>>>>&26	search/1000	PK\003\004
>>>>>>&26	use		msooxml	
>>>>>>&26	default		x		Microsoft OOXML
@


1.1.1.5.14.2
log
@Sync with head
@
text
@d3 1
a3 1
# $File: msooxml,v 1.10 2018/10/08 18:25:25 christos Exp $
a26 1
>0x1E		use		msooxml
d31 1
a31 1
>>(18.l+49)	search/6000	PK\003\004
d34 1
a34 1
>>>&26		search/6000	PK\003\004
d41 1
a41 1
>>>>>&26	search/6000	PK\003\004
a43 1
>>>>>&26	default		x		Microsoft OOXML
@


1.1.1.6
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
@d3 1
a3 1
# $File: msooxml,v 1.7 2018/03/12 12:38:59 christos Exp $
a14 8
0		name		msooxml
>0		string		word/		Microsoft Word 2007+
!:mime application/vnd.openxmlformats-officedocument.wordprocessingml.document
>0		string		ppt/		Microsoft PowerPoint 2007+
!:mime application/vnd.openxmlformats-officedocument.presentationml.presentation
>0		string		xl/		Microsoft Excel 2007+
!:mime application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

d30 7
a36 6
>>>>&26		use		msooxml	
>>>>&26		default		x
# OpenOffice/Libreoffice orders ZIP entry differently, so check the 4th file
>>>>>&26	search/1000	PK\003\004
>>>>>>&26	use		msooxml	
>>>>>>&26	default		x		Microsoft OOXML
@


1.1.1.6.2.1
log
@Sync with HEAD
@
text
@d3 1
a3 1
# $File: msooxml,v 1.12 2019/04/19 00:42:27 christos Exp $
d27 1
a27 2
>0x1E		use		msooxml
>0x1E		regex		\\[Content_Types\\]\\.xml|_rels/\\.rels|docProps
d31 1
a31 1
>>(18.l+49)	search/6000	PK\003\004
d34 1
a34 1
>>>&26		search/6000	PK\003\004
d37 1
a37 1
# https://technet.microsoft.com/en-us/library/cc179224.aspx
d41 1
a41 1
>>>>>&26	search/6000	PK\003\004
a43 1
>>>>>&26	default		x		Microsoft OOXML
@


1.1.1.6.2.2
log
@Merge changes from current as of 20200406
@
text
@d3 1
a3 1
# $File: msooxml,v 1.13 2019/11/27 13:12:55 christos Exp $
a21 2
0		string		visio/		Microsoft Visio 2013+
!:mime application/vnd.ms-visio.drawing.main+xml
@


1.1.1.7
log
@2018-10-18  19:32  Christos Zoulas <christos@@zoulas.com>

	* release 5.35

2018-09-10  20:38  Christos Zoulas <christos@@zoulas.com>

	* Add FreeBSD ELF core file support (John Baldwin)

2018-08-20  18:40  Christos Zoulas <christos@@zoulas.com>

	* PR/30: Allow all parameter values to be set (don't treat 0 specially)
	* handle default annotations on the softmagic match instead at the
	  end.

2018-07-25  10:17  Christos Zoulas <christos@@zoulas.com>

	* PR/23: Recognize JSON files

2018-07-25  10:17  Christos Zoulas <christos@@zoulas.com>

	* PR/18: file --mime-encoding should not print mime-type

2018-07-25   8:50  Christos Zoulas <christos@@zoulas.com>

	* release 5.34

2018-06-22  16:38  Christos Zoulas <christos@@zoulas.com>

	* Add Quad indirect offsets

2018-05-24  14:10  Christos Zoulas <christos@@zoulas.com>

	* Enable parsing of ELF dynamic sections to handle PIE better
@
text
@d3 1
a3 1
# $File: msooxml,v 1.10 2018/10/08 18:25:25 christos Exp $
a26 1
>0x1E		use		msooxml
d31 1
a31 1
>>(18.l+49)	search/6000	PK\003\004
d34 1
a34 1
>>>&26		search/6000	PK\003\004
d41 1
a41 1
>>>>>&26	search/6000	PK\003\004
a43 1
>>>>>&26	default		x		Microsoft OOXML
@


1.1.1.8
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
@d3 1
a3 1
# $File: msooxml,v 1.12 2019/04/19 00:42:27 christos Exp $
d28 1
a28 1
>0x1E		regex		\\[Content_Types\\]\\.xml|_rels/\\.rels|docProps
d38 1
a38 1
# https://technet.microsoft.com/en-us/library/cc179224.aspx
@


1.1.1.9
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
@d3 1
a3 1
# $File: msooxml,v 1.13 2019/11/27 13:12:55 christos Exp $
a21 2
0		string		visio/		Microsoft Visio 2013+
!:mime application/vnd.ms-visio.drawing.main+xml
@


1.1.1.10
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
@d3 1
a3 1
# $File: msooxml,v 1.15 2020/09/05 22:59:14 christos Exp $
d22 1
a22 1
>0		string		visio/		Microsoft Visio 2013+
d30 1
a30 2
>0x1E		default		x
>>0x1E		regex		\\[Content_Types\\]\\.xml|_rels/\\.rels|docProps
d34 1
a34 1
>>>(18.l+49)	search/6000	PK\003\004
d37 1
a37 1
>>>>&26		search/6000	PK\003\004
d41 2
a42 2
>>>>>&26		use		msooxml	
>>>>>&26		default		x
d44 3
a46 3
>>>>>>&26	search/6000	PK\003\004
>>>>>>>&26	use		msooxml	
>>>>>>>&26	default		x		Microsoft OOXML
@


1.1.1.11
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
@d3 1
a3 1
# $File: msooxml,v 1.18 2022/08/16 11:16:39 christos Exp $
a17 1
!:ext	docx
a19 1
!:ext	pptx
a21 1
!:ext	xlsx
a23 2
>0		string		AppManifest.xaml	Microsoft Silverlight Application
!:mime application/x-silverlight-app
d31 1
a31 1
>>0x1E		regex		\\[Content_Types\\]\\.xml|_rels/\\.rels|docProps|customXml
a46 5
# Some OOXML generators add an extra customXml directory. Check another file.
>>>>>>>&26	default		x
>>>>>>>>&26	search/6000	PK\003\004
>>>>>>>>>&26	use		msooxml	
>>>>>>>>>&26	default		x		Microsoft OOXML
@


1.1.1.12
log
@Update to file-5.45 (Last was file-5.44)

2023-07-27  15:45  Christos Zoulas <christos@@zoulas.com>

	* release 5.45

2023-07-17  11:53  Christos Zoulas <christos@@zoulas.com>

	* PR/465: psrok1: Avoid muslc asctime_r crash

2023-05-21  13:05  Christos Zoulas <christos@@zoulas.com>

	* add SIMH tape format support

2023-02-09  12:50  Christos Zoulas <christos@@zoulas.com>

	* bump the max size of the elf section notes to be read to 128K
	  and make it configurable

2023-01-08   1:08  Christos Zoulas <christos@@zoulas.com>

	* PR/415: Fix decompression with program returning empty

2022-12-26   1:47  Christos Zoulas <christos@@zoulas.com>

	* PR/408: fix -p with seccomp
	* PR/412: fix MinGW compilation
@
text
@d3 1
a3 1
# $File: msooxml,v 1.19 2023/03/14 19:46:15 christos Exp $
a58 10
>>0x1E		regex		\\[trash\\]
>>>&26		search/6000	PK\003\004
>>>>&26		search/6000	PK\003\004
>>>>>&26	use		msooxml	
>>>>>&26	default		x	
>>>>>>&26	search/6000	PK\003\004
>>>>>>>&26	use		msooxml	
>>>>>>>&26	default		x		Microsoft OOXML
>>>>>>&26	default		x		Microsoft OOXML
>>>>>&26	default		x		Microsoft OOXML
@


1.1.1.13
log
@Import file-5.48 (previous was file-5.45)

2026-05-07  11:32  Christos Zoulas <christos@@zoulas.com>

	* release 5.48

2026-05-11  15:55 Christos Zoulas <christos@@zoulas.com>

	* add landlock support (valoq)

2026-04-19  15:55 Christos Zoulas <christos@@zoulas.com>

	* add BE/LE GUID

2026-04-17  11:05 Christos Zoulas <christos@@zoulas.com>

	* multiple fixes to prevent integer overflow in 32 bits (kerwin)

2026-04-15  12:40 Christos Zoulas <christos@@zoulas.com>

	* PR/745: streamout: Don't flush when trying to set negative offsets
	          on pipes, just continue, fixes 'cat file.zip | file -'
	* PR/753: vmihalko: Fix race is magic_getpath()

2026-03-11  15:14 Christos Zoulas <christos@@zoulas.com>

	* PR/728: Anton Monroe: Reinstate regex/c

2026-02-26  11:32  Christos Zoulas <christos@@zoulas.com>

	* release 5.47

2026-02-04  09:54  Christos Zoulas <christos@@zoulas.com>
	* Better multi-compound document identification by following the
	  order of the directories entries. (Thomas Ledoux)

2026-01-19  14:00  Christos Zoulas <christos@@zoulas.com>
	* if stat fails, don't attempt to restore times (Steven Grubb)

2025-05-28  15:20  Christos Zoulas <christos@@zoulas.com>

	* PR/622: Odd_Bloke: Handle negative offsets in file_buffer(),
	  when fd is not available.

2025-05-28  12:50  Christos Zoulas <christos@@zoulas.com>

	* PR/655: jsummers: Obey str_flags in strings like we do for search
	  and regex
	* PR/659: Pitzl: Apply MAGIC_CONTINUE to annotations; i.e. print
	  only the first, unless -k is specified.

2024-12-19  14:44  Christos Zoulas <christos@@zoulas.com>

	* PR/592: allow + in format strings
	* PR/592: signed operations should be done in signed context

2024-12-05  13:50 Christos Zoulas <christos@@zoulas.com>

	* PR/578: jsummers: Don't crash on cygwin when tm_mon == -1
	* PR/579: net147: Fix stack overrun.

2024-11-27  14:44  Christos Zoulas <christos@@zoulas.com>

	* release 5.46
	* Add OFFPOSITIVE

2024-11-25  13:56  Christos Zoulas <christos@@zoulas.com>

	* avoid leaking symbols in libmagic

2024-11-10  13:56  Christos Zoulas <christos@@zoulas.com>

	* PR/562: jsummers: Search/regex offsets are absolute to the
	  beginning of the file, so adjust them by subtracting the
	  offset that the "use" starts so that we don't double-count it.


2024-11-09  19:30  Christos Zoulas <christos@@zoulas.com>
 	* PR/543: matshch: bump nbuf so we can get the flags into the buffer.


2024-11-02  14:34  Christos Zoulas <christos@@zoulas.com>

 	* Add Android elf notes (enh)

2023-12-29  12:55  Christos Zoulas <christos@@zoulas.com>

	* Add limit for number of magic warnings allowed

2023-07-29  12:55  Christos Zoulas <christos@@zoulas.com>

	* check regex bounds (found by clusterfuzz)
@
text
@d3 1
a3 1
# $File: msooxml,v 1.24 2025/05/29 15:03:04 christos Exp $
a28 2
>0		search/100	.nuspec		NuGet package
!:mime application/vnd.nuget.package
d36 1
a36 1
>>0x1E		regex		\\[Content_Types\\]\\.xml|_rels/\\.rels|docProps|customXml|.*\\.md|.*\\.png
d40 1
a40 3
>>>&26		search/10000	PK\003\004
>>>>&26		use		msooxml
>>>>&26		default		x
d43 1
a43 1
>>>>>&26	search/10000	PK\003\004
d45 1
a45 1
# file we have.	 Correct the mimetype with the registered ones:
d47 2
a48 2
>>>>>>&26	use		msooxml
>>>>>>&26	default		x
d50 2
a51 2
>>>>>>>&26	search/10000	PK\003\004
>>>>>>>>&26	use		msooxml
d53 3
a55 9
>>>>>>>>&26	default		x
>>>>>>>>>&26	search/10000	PK\003\004
>>>>>>>>>>&26	use		msooxml
>>>>>>>>>>&26	default		x
>>>>>>>>>>>&26	search/10000	PK\003\004
>>>>>>>>>>>>&26	use		msooxml
>>>>>>>>>>>>&26	default		x		Microsoft OOXML
>>>>>>>>>>>&26	default		x		Microsoft OOXML
>>>>>>>>>>&26	default		x		Microsoft OOXML
a56 1
>>>>>>>>&26	default		x		Microsoft OOXML
d58 1
a58 1
>>>>>>&26	default		x		Microsoft OOXML
d60 6
a65 6
>>>&26		search/10000	PK\003\004
>>>>&26		search/10000	PK\003\004
>>>>>&26	use		msooxml
>>>>>&26	default		x
>>>>>>&26	search/10000	PK\003\004
>>>>>>>&26	use		msooxml
@


