7 This directory contains bunch of files to test handling of .lzma files
8 in .lzma decoder implementations. Many of the files have been created
9 by hand with a hex editor, thus there is no better "source code" than
10 the files themselves. All the test files (*.lzma) and this README have
11 been put into the public domain.
16 Good files (good-*.lzma) must decode successfully without requiring
17 a lot of CPU time or RAM. If the decoder supports only Single-Block
18 Streams, then good-multi-*.lzma won't decode, of course.
20 Bad files (bad-*.lzma) must cause the decoder to give an error. Like
21 with the good files, these files must not require a lot of CPU time
22 or RAM before they get detected to be broken.
24 Malicious files (malicious-*.lzma) are good in terms of the file format
25 specification, but try to trigger excessive CPU, RAM or disk usage in
26 the decoder. To prevent malicious files from putting the decoder in
27 inifinite loop (*), eating all available RAM or disk space, decoders
28 should have internal limitters that catch these situations.
30 (*) Strictly speaking not infinite, but if decoding of a small file
31 would take a few weeks or even years, it's an infinite loop in
35 2. Descriptions of Individual Files
39 good-single-none.lzma uses implicit Copy filter with known Uncompressed
42 good-single-none-pad.lzma is good-single-none.lzma with Footer Padding.
44 good-cat-single-none-pad.lzma is two good-single-none-pad.lzma files
45 concatenated as is. Fully decoding this file requires that the decoder
46 supports decoding concatenated files.
48 good-single-subblock_implicit.lzma uses implicit Subblock filter.
50 good-single-lzma.lzma is LZMA compressed file with EOPM.
52 good-single-subblock-lzma.lzma has basic combination of Subblock and
55 good-single-none-empty_1.lzma is an empty file with implicit Copy
56 filter and no integrity Check.
58 good-single-none-empty_2.lzma is an empty file with implicit Copy
59 filter and CRC32 as Check.
61 good-single-none-empty_3.lzma is an empty file with implicit Copy
62 filter, known Compressed Size, and no integrity Check.
64 good-single-lzma-empty.lzma is an empty file with LZMA filter and no
67 good-single-subblock_rle.lzma takes advantage of Subblock filter's
70 good-single-delta-lzma.tiff.lzma is an image file that compresses
71 better with Delta+LZMA than with plain LZMA.
73 good-single-lzma-flush_1.lzma has a flush marker in the middle of
74 the file, and no EOPM.
76 good-single-lzma-flush_2.lzma has a flush marker in the middle of
77 the file and just before EOPM.
79 good-multi-none-1.lzma is a basic Multi-Block Stream with two Data
80 Blocks and Footer Metadata Block.
82 good-multi-none-2.lzma is good-multi-none-1.lzma with Total Size and
83 Uncompressed Size added to the Footer Metadata Block.
85 good-multi-none-extra_1.lzma has the `Extra is present' flag set but
86 no actual Extra Records.
88 good-multi-none-extra_2.lzma has two non-empty Extra Records.
90 good-multi-none-extra_3.lzma has an Extra Record that has empty Data.
92 good-multi-none-header_1.lzma has very minimal Header Metadata Block
93 with only the Metadata Flags field.
95 good-multi-none-header_2.lzma has all information in both Header and
96 Footer Metadata Blocks. The Size of Header Metadata Block has wrong
97 value in Header Metadata Block, but this value must be ignored by
98 the decoder in case of Header Metadata Block.
103 bad-single-none-truncated.lzma is good-single-none.lzma without the
104 last byte of the file.
106 bad-cat-single-none-pad_garbage_1.lzma is good-cat-single-none-pad.lzma
107 with 0xFE appended to the end of the file. 0xFE doesn't begin .lzma
108 or LZMA_Alone format file.
110 bad-cat-single-none-pad_garbage_2.lzma is good-cat-single-none-pad.lzma
111 with 0xFF appended to the end of the file. 0xFF begins .lzma format
112 file, thus the decoder has to detect that the file is incomplete.
114 bad-cat-single-none-pad_garbage_3.lzma is good-cat-single-none-pad.lzma
115 with 0x5D appended to the end of the file. 0x5D is the most common
116 first byte of LZMA_Alone format file.
118 bad-single-none-footer_filter_flags.lzma has different Stream Flags
119 in Stream Footer than in Stream Header.
121 bad-single-none-too_long_vli.lzma has 10-byte variable-length integer.
123 bad-single-none-empty.lzma is like good-single-none-empty_3.lzma but
124 with non-zero value in the Compressed Size field.
126 bad-single-data_after_eopm_1.lzma has LZMA+Subblock, where the Subblock
127 filter gives one byte of data to LZMA after LZMA has detected EOPM.
129 bad-single-data_after_eopm_2.lzma is like
130 bad-single-data_after_eopm_1.lzma but Subblock gives 256 MiB of data
131 to LZMA after LZMA has detected EOPM.
133 bad-single-subblock_subblock.lzma has Subblock+Subblock, where the
134 Subblock decoder is given End of Input in the middle of a Subblock.
136 bad-single-subblock-padding_loop.lzma contains huge amount of
137 consecutive Padding bytes, which isn't allowed by the Subblock filter
138 format. If it were allowed, this file would hang the decoder for very
139 long time (weeks to years).
141 bad-single-subblock1023-slow.lzma is similar to
142 malicious-single-subblock31-slow.lzma except that this uses 1023 bytes
143 of Padding in every place instead of 31 bytes. The Subblock filter
144 format specification allows only 31-byte Padings, thus this file must
145 get detected as bad without producing any output. Allowing larger
146 Padding than 31 bytes was considered (so this test file was created),
147 but it seemed to be a bad idea since it would increase worst-case CPU
150 bad-single-lzma-flush_beginning.lzma has flush marker in the beginning
153 bad-single-lzma-flush_twice.lzma has two flush markers with no data
156 bad-multi-none-1.lzma has data after the last field in the Metadata
157 Block and the `Extra is present' flag is not set.
159 bad-multi-none-2.lzma has wrong Total Size in Footer Metadata Block.
161 bad-multi-none-3.lzma has wrong Uncompressed Size in Footer Metadata
164 bad-multi-none-index_1.lzma has wrong value in the Number of Data
167 bad-multi-none-index_2.lzma has too short Metadata to contain all
170 bad-multi-none-index_3.lzma has wrong value in Total Size field in
173 bad-multi-none-index_4.lzma has wrong value in Uncompressed Size field
176 bad-multi-none-extra_1.lzma has incomplete Extra Record at the end of
179 bad-multi-none-extra_2.lzma has incomplete variable-length integer as
182 bad-multi-none-extra_3.lzma has incomplete Extra Record at the end of
185 bad-multi-none-header_1.lzma has empty Header Metadata Block (even
186 the Metadata Flags field is not present).
191 malicious-single-subblock31-slow.lzma requires quite a bit of CPU time
192 per decoded byte. It contains LZMA compressed Subblock filter data that
193 has as much Padding as the specification allows. LZMA is also used as
194 a Subfilter, to further slowdown the decoder. Every Subfilter instance
195 produces only one byte of output. If you can create a file that wastes
196 notably more CPU cycles than this file, please contact Lasse Collin.
198 malicious-single-subblock-256MiB.lzma is a tiny file that produces
199 256 MiB of output. It uses Subblock filter's run-length encoding
202 malicious-single-subblock-64PiB.lzma is a tiny file that produces
203 64 PiB of output (if you have patience to wait). This is done by
204 chaining two Subblock filters and using their run-length encoders.
206 malicious-multi-metadata-64PiB.lzma is like
207 malicious-single-subblock-64PiB.lzma but the huge amount of output
208 is in a Metadata Block. Trying to decode this file may take years
209 unless the decoder catches that the Metadata has unreasonable size.