Fanbase

xz/xz-boundary

version 1.0

Same as xz, at the edges: streams of no blocks, stream padding, BCJ filters, padded block headers, data that does not compress, LZMA2 chunks written out, dictionaries up to 48 MiB

Format
XZ (xz)
Authors
The Fandango Fuzzer Team
License
Apache-2.0
Fandango
>=1.3
Extensions
xz
Media type
application/x-xz
Specification
https://tukaani.org/xz/xz-file-format.txt
Extends
xz
Its files should decode
always
In the registry
specs/xz/xz-boundary/xz-boundary.fan

Use it

fanbase install xz-boundary
fandango fuzz -F xz-boundary -n 10

How it does

accepts 100%, covers 66.9%, 6.3/s. 632 inputs, seed 1.

ParserAcceptsVersion
7zip100%25.01
7zip-xz-cov100%7-Zip (xz) 26.05
liblzma-cov100%liblzma (XZ Utils) 5.8.4
python-lzma95%3.12.16
xz100%xz (XZ Utils) 5.8.1

The spec says its files decode always: as expected.

7zip-xz-cov

lines reached
66.9% of 3539
real files reach
55.6%
only the generated files
434 lines
only the real files
33 lines
54.4% after 1 inputs, 66.9% after 632real files: 55.6%

liblzma-cov

lines reached
61.5% of 2471
real files reach
56.6%
only the generated files
182 lines
only the real files
61 lines
53.4% after 1 inputs, 61.5% after 632real files: 56.6%

Cite it

@software{fanbase_xz_xz_boundary_1_0,
  author  = {{The Fandango Fuzzer Team}},
  title   = {XZ (xz/xz-boundary), a Fandango input specification},
  version = {1.0},
  url     = {https://github.com/fandango-fuzzer/fanbase},
  note    = {Fanbase registry, specs/xz/xz-boundary/xz-boundary.fan, sha256 354b3ef59026},
}

Source

Source (36 lines)
# Same as xz, at the edges of the .xz format: streams of no blocks (an Index
# of no records), one to three streams with stream padding (zero bytes, a
# multiple of four) between them and after the last, the BCJ filters (x86,
# PowerPC, IA-64, ARM, ARM-Thumb, SPARC) before Delta or LZMA2, block headers
# padded beyond what they need (up to 1,024 bytes), data that does not
# compress (LZMA2 stores it in an uncompressed chunk), LZMA2 data in two to
# four chunks, and dictionaries of up to 48 MiB. xz_file() of xz makes the
# file from the draft.
#
# TODO:
# * No check IDs other than the four that xz defines, and no filter chains
#   of more than three filters.

include("xz/xz.fan")

<streams> ::= <stream> (<stream_padding> <stream>){0,2} <stream_padding>?
<stream_padding> ::= rb'(\x00\x00\x00\x00){1,8}'

<stream> ::= <check_id> <block>{0,3}

<block> ::= <filters> <sizes>? <header_padding>? <dict_prop> <payload> <chunks>?
<payload> ::= <repeat> <data> | <noise>
<noise> ::= b'N' <byte>{4}

# LZMA2 data in this many uncompressed chunks (only in blocks of LZMA2 alone)
<chunks> ::= rb'[\x02-\x04]'
# More words of zero padding in the block header (at most 255 in all)
<header_padding> ::= b'P' <header_words>
<header_words> ::= rb'[\x01-\xf0]'

<filters> ::= <lzma2> | <delta> <lzma2> | <bcj> <lzma2> | <bcj> <delta> <lzma2>
<bcj> ::= b'B' <bcj_id>
<bcj_id> ::= b'\x04' | b'\x05' | b'\x06' | b'\x07' | b'\x08' | b'\x09'

# 4 KiB (0) to 48 MiB (27)
<dict_prop> ::= rb'[\x00-\x1b]'