streaming 7-Zip archive extractor
0

Configure Feed

Select the types of activity you want to include in your feed.

chore: vendor libarchive 7zip test corpus

+221
+18
deno.lock
··· 1 + { 2 + "version": "5", 3 + "specifiers": { 4 + "jsr:@std/internal@^1.0.14": "1.0.14", 5 + "jsr:@std/path@1": "1.1.5" 6 + }, 7 + "jsr": { 8 + "@std/internal@1.0.14": { 9 + "integrity": "291516b3d4c35024d6ffbc0a9df5bf4c64116e05b50012cf846710152d2ffdf7" 10 + }, 11 + "@std/path@1.1.5": { 12 + "integrity": "ccea00982ea28c36becaf6e62f855406c76a8c32d462f66f415bbb7d83a271bc", 13 + "dependencies": [ 14 + "jsr:@std/internal" 15 + ] 16 + } 17 + } 18 + }
+99
scripts/decode-uu-fixtures.ts
··· 1 + /** 2 + * decode `.7z.uu` (uuencoded) fixtures from libarchive into raw `.7z` binaries. 3 + * 4 + * usage: deno run --allow-read --allow-write scripts/decode-uu-fixtures.ts <src-dir> <dst-dir> 5 + * 6 + * reads every `*.7z.uu` under <src-dir>, writes the decoded binary to <dst-dir> 7 + * with the `.uu` suffix stripped. python 3.14 dropped the `uu` module so we 8 + * keep our own minimal decoder rather than depend on it. 9 + */ 10 + 11 + import { basename, join } from 'jsr:@std/path@^1.0.0'; 12 + 13 + const decodeLine = (line: string): Uint8Array => { 14 + const len = line.charCodeAt(0) - 32; 15 + if (len <= 0) { 16 + return new Uint8Array(0); 17 + } 18 + 19 + const out = new Uint8Array(len); 20 + let bi = 0; 21 + 22 + for (let i = 1; i < line.length && bi < len; i += 4) { 23 + const a = (line.charCodeAt(i + 0) - 32) & 0x3f; 24 + const b = (line.charCodeAt(i + 1) - 32) & 0x3f; 25 + const c = (line.charCodeAt(i + 2) - 32) & 0x3f; 26 + const d = (line.charCodeAt(i + 3) - 32) & 0x3f; 27 + 28 + out[bi++] = (a << 2) | (b >> 4); 29 + if (bi < len) { 30 + out[bi++] = ((b & 0x0f) << 4) | (c >> 2); 31 + } 32 + if (bi < len) { 33 + out[bi++] = ((c & 0x03) << 6) | d; 34 + } 35 + } 36 + 37 + return out; 38 + }; 39 + 40 + const decode = (src: string): Uint8Array => { 41 + const lines = src.split('\n'); 42 + const chunks: Array<Uint8Array> = []; 43 + let started = false; 44 + 45 + for (const raw of lines) { 46 + const line = raw.replace(/\r$/, ''); 47 + 48 + if (!started) { 49 + if (line.startsWith('begin ')) { 50 + started = true; 51 + } 52 + continue; 53 + } 54 + 55 + if (line === 'end' || line === '`') { 56 + break; 57 + } 58 + 59 + chunks.push(decodeLine(line)); 60 + } 61 + 62 + let total = 0; 63 + for (const c of chunks) { 64 + total += c.length; 65 + } 66 + 67 + const out = new Uint8Array(total); 68 + let off = 0; 69 + for (const c of chunks) { 70 + out.set(c, off); 71 + off += c.length; 72 + } 73 + 74 + return out; 75 + }; 76 + 77 + const [srcDir, dstDir] = Deno.args; 78 + if (!srcDir || !dstDir) { 79 + console.error('usage: deno run --allow-read --allow-write scripts/decode-uu-fixtures.ts <src-dir> <dst-dir>'); 80 + Deno.exit(2); 81 + } 82 + 83 + let count = 0; 84 + for (const entry of Deno.readDirSync(srcDir)) { 85 + if (!entry.isFile || !entry.name.endsWith('.uu')) { 86 + continue; 87 + } 88 + if (!/\.(7z|exe|elf)\.uu$/.test(entry.name)) { 89 + continue; 90 + } 91 + 92 + const src = Deno.readTextFileSync(join(srcDir, entry.name)); 93 + const bin = decode(src); 94 + const outName = basename(entry.name, '.uu'); 95 + Deno.writeFileSync(join(dstDir, outName), bin); 96 + count++; 97 + } 98 + 99 + console.log(`decoded ${count} files into ${dstDir}`);
+65
tests/fixtures/libarchive/LICENSE
··· 1 + The libarchive distribution as a whole is Copyright by Tim Kientzle 2 + and is subject to the copyright notice reproduced at the bottom of 3 + this file. 4 + 5 + Each individual file in this distribution should have a clear 6 + copyright/licensing statement at the beginning of the file. If any do 7 + not, please let me know and I will rectify it. The following is 8 + intended to summarize the copyright status of the individual files; 9 + the actual statements in the files are controlling. 10 + 11 + * Except as listed below, all C sources (including .c and .h files) 12 + and documentation files are subject to the copyright notice reproduced 13 + at the bottom of this file. 14 + 15 + * The following source files are also subject in whole or in part to 16 + a 3-clause UC Regents copyright; please read the individual source 17 + files for details: 18 + libarchive/archive_read_support_filter_compress.c 19 + libarchive/archive_write_add_filter_compress.c 20 + libarchive/mtree.5 21 + 22 + * The following source files are in the public domain: 23 + libarchive/archive_parse_date.c 24 + 25 + * The following source files are triple-licensed with the ability to choose 26 + from CC0 1.0 Universal, OpenSSL or Apache 2.0 licenses: 27 + libarchive/archive_blake2.h 28 + libarchive/archive_blake2_impl.h 29 + libarchive/archive_blake2s_ref.c 30 + libarchive/archive_blake2sp_ref.c 31 + 32 + * The build files---including Makefiles, configure scripts, 33 + and auxiliary scripts used as part of the compile process---have 34 + widely varying licensing terms. Please check individual files before 35 + distributing them to see if those restrictions apply to you. 36 + 37 + I intend for all new source code to use the license below and hope over 38 + time to replace code with other licenses with new implementations that 39 + do use the license below. The varying licensing of the build scripts 40 + seems to be an unavoidable mess. 41 + 42 + 43 + Copyright (c) 2003-2018 <author(s)> 44 + All rights reserved. 45 + 46 + Redistribution and use in source and binary forms, with or without 47 + modification, are permitted provided that the following conditions 48 + are met: 49 + 1. Redistributions of source code must retain the above copyright 50 + notice, this list of conditions and the following disclaimer 51 + in this position and unchanged. 52 + 2. Redistributions in binary form must reproduce the above copyright 53 + notice, this list of conditions and the following disclaimer in the 54 + documentation and/or other materials provided with the distribution. 55 + 56 + THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 57 + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 58 + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 59 + IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 60 + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 61 + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 62 + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 63 + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 64 + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 65 + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+39
tests/fixtures/libarchive/README.md
··· 1 + # libarchive 7zip test corpus 2 + 3 + the `.7z` / `.exe` / `.elf` files in this directory are vendored from the 4 + [libarchive](https://github.com/libarchive/libarchive) project's 7zip-reader 5 + test suite. 6 + 7 + ## provenance 8 + 9 + | | | 10 + | --- | --- | 11 + | source | <https://github.com/libarchive/libarchive> | 12 + | path | `libarchive/test/test_read_format_7zip_*.{7z,exe,elf}.uu` | 13 + | commit | `d6654b4e01b46ed73f2cd8b3c9a44446c30a21b7` | 14 + | date | 2026-05-27 | 15 + 16 + upstream ships each fixture as a uuencoded text file. to refresh the corpus, 17 + re-clone libarchive at a known commit, run 18 + `deno run --allow-read --allow-write scripts/decode-uu-fixtures.ts <upstream>/libarchive/test tests/fixtures/libarchive`, 19 + delete the unrelated RAR sfx files (`test_read_format_rar*_sfx.exe`), and 20 + update the table above. 21 + 22 + these files are licensed under BSD-2-Clause (see `LICENSE` in this directory), 23 + separate from the 0BSD license covering the rest of this repository. they are 24 + used as test fixtures only and are not part of the published package. 25 + 26 + ## notes 27 + 28 + - filenames follow upstream's `test_read_format_7zip_<codec-chain>.7z` 29 + convention; the suffix declares the coder chain (e.g. `bcj2_lzma2_1`, 30 + `delta_lzma2`, `zstd_bcj`) 31 + - `*_sfx_pe.exe` / `*_sfx_elf.elf` are self-extracting variants — a PE/ELF 32 + loader prepended to a 7z stream; readers should locate the magic and parse 33 + from there 34 + - `malformed.7z` / `malformed2.7z` / `malformed3.7z` and `entries_oom.7z` are 35 + intentionally broken inputs for error-path coverage 36 + - `extract_second.7z` exercises seeking to the second file in a solid block 37 + - `encryption_data.c` (not vendored) holds the plaintext key data the 38 + upstream C tests compare against; we re-derive expected output by extracting 39 + with system `7z` instead
tests/fixtures/libarchive/test_read_format_7zip_bcj2_bzip2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj2_copy_1.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj2_copy_2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj2_copy_lzma.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj2_deflate.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj2_lzma1_1.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj2_lzma1_2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj2_lzma2_1.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj2_lzma2_2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj_bzip2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj_copy.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj_deflate.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj_lzma1.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bcj_lzma2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_bzip2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_copy.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_copy_2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_deflate.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_deflate_arm64.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_deflate_powerpc.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_delta4_lzma1.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_delta4_lzma2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_delta_lzma1.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_delta_lzma2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_empty_archive.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_empty_file.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_encryption.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_encryption_header.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_encryption_partially.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_entries_oom.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_extract_second.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_issue2765.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_lzma1.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_lzma1_2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_lzma1_lzma2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_lzma2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_lzma2_arm.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_lzma2_arm64.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_lzma2_powerpc.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_lzma2_riscv.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_lzma2_sparc.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_malformed.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_malformed2.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_malformed3.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_packinfo_digests.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_ppmd.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_sfx_elf.elf

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_sfx_elf64trunc.elf

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_sfx_modified_pe.exe

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_sfx_pe.exe

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_solid_zstd.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_symbolic_name.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_win_attrib.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_zstd.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_zstd_arm.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_zstd_bcj.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_zstd_nobcj.7z

This is a binary file and will not be displayed.

tests/fixtures/libarchive/test_read_format_7zip_zstd_sparc.7z

This is a binary file and will not be displayed.