From c8f70ebb4628ceb6cb29cc9195d9deadf69d2bd7 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Thu, 20 Oct 2022 15:35:59 +0300 Subject: Tests: Add .lz (lzip) test files. --- tests/files/README | 109 +++++++++++++++++++++++++++++---- tests/files/bad-1-v0-uncomp-size.lz | Bin 0 -> 42 bytes tests/files/bad-1-v1-crc32.lz | Bin 0 -> 50 bytes tests/files/bad-1-v1-dict-1.lz | Bin 0 -> 50 bytes tests/files/bad-1-v1-dict-2.lz | Bin 0 -> 50 bytes tests/files/bad-1-v1-magic-1.lz | Bin 0 -> 50 bytes tests/files/bad-1-v1-magic-2.lz | Bin 0 -> 50 bytes tests/files/bad-1-v1-member-size.lz | Bin 0 -> 50 bytes tests/files/bad-1-v1-trailing-magic.lz | Bin 0 -> 54 bytes tests/files/bad-1-v1-uncomp-size.lz | Bin 0 -> 50 bytes tests/files/good-1-v0-trailing-1.lz | Bin 0 -> 59 bytes tests/files/good-1-v0.lz | Bin 0 -> 42 bytes tests/files/good-1-v1-trailing-1.lz | Bin 0 -> 67 bytes tests/files/good-1-v1-trailing-2.lz | Bin 0 -> 70 bytes tests/files/good-1-v1.lz | Bin 0 -> 50 bytes tests/files/good-2-v0-v1.lz | Bin 0 -> 78 bytes tests/files/good-2-v1-v0.lz | Bin 0 -> 78 bytes tests/files/good-2-v1-v1.lz | Bin 0 -> 86 bytes tests/files/unsupported-1-v234.lz | Bin 0 -> 50 bytes 19 files changed, 98 insertions(+), 11 deletions(-) create mode 100644 tests/files/bad-1-v0-uncomp-size.lz create mode 100644 tests/files/bad-1-v1-crc32.lz create mode 100644 tests/files/bad-1-v1-dict-1.lz create mode 100644 tests/files/bad-1-v1-dict-2.lz create mode 100644 tests/files/bad-1-v1-magic-1.lz create mode 100644 tests/files/bad-1-v1-magic-2.lz create mode 100644 tests/files/bad-1-v1-member-size.lz create mode 100644 tests/files/bad-1-v1-trailing-magic.lz create mode 100644 tests/files/bad-1-v1-uncomp-size.lz create mode 100644 tests/files/good-1-v0-trailing-1.lz create mode 100644 tests/files/good-1-v0.lz create mode 100644 tests/files/good-1-v1-trailing-1.lz create mode 100644 tests/files/good-1-v1-trailing-2.lz create mode 100644 tests/files/good-1-v1.lz create mode 100644 tests/files/good-2-v0-v1.lz create mode 100644 tests/files/good-2-v1-v0.lz create mode 100644 tests/files/good-2-v1-v1.lz create mode 100644 tests/files/unsupported-1-v234.lz (limited to 'tests/files') diff --git a/tests/files/README b/tests/files/README index 3e550dfe..4aca0b11 100644 --- a/tests/files/README +++ b/tests/files/README @@ -4,25 +4,25 @@ 0. Introduction - This directory contains bunch of files to test handling of .xz - and .lzma files in decoder implementations. Many of the files have - been created by hand with a hex editor, thus there is no better - "source code" than the files themselves. All the test files and - this README have been put into the public domain. + This directory contains bunch of files to test handling of .xz, + .lzma (LZMA_Alone), and .lz (lzip) files in decoder implementations. + Many of the files have been created by hand with a hex editor, thus + there is no better "source code" than the files themselves. All the + test files and this README have been put into the public domain. 1. File Types - Good files (good-*.xz, good-*.lzma) must decode successfully - without requiring a lot of CPU time or RAM. + Good files (good-*) must decode successfully without requiring + a lot of CPU time or RAM. - Unsupported files (unsupported-*.xz) are good files, but headers + Unsupported files (unsupported-*) are good files, but headers indicate features not supported by the current file format specification. - Bad files (bad-*.xz, bad-*.lzma) must cause the decoder to give - an error. Like with the good files, these files must not require - a lot of CPU time or RAM before they get detected to be broken. + Bad files (bad-*) must cause the decoder to give an error. Like + with the good files, these files must not require a lot of CPU + time or RAM before they get detected to be broken. 2. Descriptions of Individual .xz Files @@ -313,3 +313,90 @@ bad-too_small_size-without_eopm-3.lzma is like -1 above but instead of a literal the problem occurs in the middle of a match. + +4. Descriptions of Individual .lz (lzip) Files + +4.1. Good Files + + good-1-v0.lz contains a single version 0 member. lzip 1.17 and + *older* can decompress this; support for version 0 was removed + in lzip 1.18. + + good-1-v0-trailing-1.lz is like good-1-v0.lz but contains + trailing data that the decompressor must ignore. + + good-1-v1.lz contains a single version 1 member. lzip 1.3 and + newer can decompress this. + + good-1-v1-trailing-1.lz is like good-1-v1.lz but contains + trailing data that the decompressor must ignore. + + good-1-v1-trailing-2.lz is like good-1-v1.lz but contains + trailing data whose first three bytes match the .lz magic bytes. + With lzip >= 1.20 this file results in an error unless one uses + the command line option --loose-trailing. lzip 1.3 to 1.19 decode + this file successfully by default. XZ Utils uses the old behavior + because it allows lzma_code() to stop at the first byte of the + trailing data as long as the first byte isn't 0x4C (L in US-ASCII); + otherwise the first 1-3 bytes that equal to the magic bytes are + consumed and lost in lzma_code(), and this is visible in xz too: + + $ ( xz -dc ; cat ) < good-1-v1-trailing-2.lz + Hello + World! + Trailing garbage + + $ ( xz -dc --single-stream ; cat ) < good-1-v1-trailing-2.lz + Hello + World! + LZITrailing garbage + + good-2-v0-v1.lz contains two members of which the first is + version 0 and the second version 1. lzip versions 1.3 to 1.17 + (inclusive) can decompress this. + + good-2-v1-v0.lz contains two members of which the first is + version 1 and the second version 0. lzip versions 1.3 to 1.17 + (inclusive) can decompress this. + + good-2-v1-v1.lz contains two version 1 members. lzip versions 1.3 + and newer can decompress this. + + +4.2. Unsupported Files + + unsupported-1-v234.lz is like good-1-v1.lz except the version + field has been set to 234 (0xEA) which, as of writing, isn't + defined or supported by any .lz implementation. + + +4.3. Bad Files + + bad-1-v1-magic-1.lz is like good-1-v1.lz but the first magic byte + is wrong. + + bad-1-v1-magic-2.lz is like good-1-v1.lz but the last (fourth) + magic byte is wrong. + + bad-1-v1-dict-1.lz has too low value in the dictionary size field. + + bad-1-v1-dict-2.lz has too high value in the dictionary size field. + + bad-1-v1-crc32.lz has wrong CRC32 value. + + bad-1-v0-uncomp-size.lz is version 0 format with incorrect value + in the uncompressed size field. + + bad-1-v1-uncomp-size.lz is version 1 format with incorrect value + in the uncompressed size field. + + bad-1-v1-member-size.lz has incorrect value in the member size + field. + + bad-1-v1-trailing-magic.lz has the four .lz magic bytes as trailing + data. This should be detected as a truncated file and thus result + in an error. That is, the last four bytes of the file should not be + ignored as trailing garbage. lzip >= 1.18 matches this behavior + while older versions ignore the last four bytes and don't indicate + an error. + diff --git a/tests/files/bad-1-v0-uncomp-size.lz b/tests/files/bad-1-v0-uncomp-size.lz new file mode 100644 index 00000000..6bf4c6c7 Binary files /dev/null and b/tests/files/bad-1-v0-uncomp-size.lz differ diff --git a/tests/files/bad-1-v1-crc32.lz b/tests/files/bad-1-v1-crc32.lz new file mode 100644 index 00000000..3387618f Binary files /dev/null and b/tests/files/bad-1-v1-crc32.lz differ diff --git a/tests/files/bad-1-v1-dict-1.lz b/tests/files/bad-1-v1-dict-1.lz new file mode 100644 index 00000000..20768d5f Binary files /dev/null and b/tests/files/bad-1-v1-dict-1.lz differ diff --git a/tests/files/bad-1-v1-dict-2.lz b/tests/files/bad-1-v1-dict-2.lz new file mode 100644 index 00000000..1f22e6d8 Binary files /dev/null and b/tests/files/bad-1-v1-dict-2.lz differ diff --git a/tests/files/bad-1-v1-magic-1.lz b/tests/files/bad-1-v1-magic-1.lz new file mode 100644 index 00000000..b5e374db Binary files /dev/null and b/tests/files/bad-1-v1-magic-1.lz differ diff --git a/tests/files/bad-1-v1-magic-2.lz b/tests/files/bad-1-v1-magic-2.lz new file mode 100644 index 00000000..f5d5b974 Binary files /dev/null and b/tests/files/bad-1-v1-magic-2.lz differ diff --git a/tests/files/bad-1-v1-member-size.lz b/tests/files/bad-1-v1-member-size.lz new file mode 100644 index 00000000..fd8636ac Binary files /dev/null and b/tests/files/bad-1-v1-member-size.lz differ diff --git a/tests/files/bad-1-v1-trailing-magic.lz b/tests/files/bad-1-v1-trailing-magic.lz new file mode 100644 index 00000000..f7926c5b Binary files /dev/null and b/tests/files/bad-1-v1-trailing-magic.lz differ diff --git a/tests/files/bad-1-v1-uncomp-size.lz b/tests/files/bad-1-v1-uncomp-size.lz new file mode 100644 index 00000000..c89a283f Binary files /dev/null and b/tests/files/bad-1-v1-uncomp-size.lz differ diff --git a/tests/files/good-1-v0-trailing-1.lz b/tests/files/good-1-v0-trailing-1.lz new file mode 100644 index 00000000..91f2b64d Binary files /dev/null and b/tests/files/good-1-v0-trailing-1.lz differ diff --git a/tests/files/good-1-v0.lz b/tests/files/good-1-v0.lz new file mode 100644 index 00000000..99e3f278 Binary files /dev/null and b/tests/files/good-1-v0.lz differ diff --git a/tests/files/good-1-v1-trailing-1.lz b/tests/files/good-1-v1-trailing-1.lz new file mode 100644 index 00000000..198e65ca Binary files /dev/null and b/tests/files/good-1-v1-trailing-1.lz differ diff --git a/tests/files/good-1-v1-trailing-2.lz b/tests/files/good-1-v1-trailing-2.lz new file mode 100644 index 00000000..9a028fa6 Binary files /dev/null and b/tests/files/good-1-v1-trailing-2.lz differ diff --git a/tests/files/good-1-v1.lz b/tests/files/good-1-v1.lz new file mode 100644 index 00000000..4c9565c8 Binary files /dev/null and b/tests/files/good-1-v1.lz differ diff --git a/tests/files/good-2-v0-v1.lz b/tests/files/good-2-v0-v1.lz new file mode 100644 index 00000000..dc3165a0 Binary files /dev/null and b/tests/files/good-2-v0-v1.lz differ diff --git a/tests/files/good-2-v1-v0.lz b/tests/files/good-2-v1-v0.lz new file mode 100644 index 00000000..a999582c Binary files /dev/null and b/tests/files/good-2-v1-v0.lz differ diff --git a/tests/files/good-2-v1-v1.lz b/tests/files/good-2-v1-v1.lz new file mode 100644 index 00000000..5381891b Binary files /dev/null and b/tests/files/good-2-v1-v1.lz differ diff --git a/tests/files/unsupported-1-v234.lz b/tests/files/unsupported-1-v234.lz new file mode 100644 index 00000000..e571b0fa Binary files /dev/null and b/tests/files/unsupported-1-v234.lz differ -- cgit v1.2.3