Probe 7z listings and ZIP starts

7z keeps its file list at the end of the archive, so the 7z-tail
candidates (the last segment of the highest volume) were queued but
never probed, and the .7z.001 start only gave the type. The prober now
claims 7z-tail candidates after the archives; lib/sevenzip finds the end
header in the article, decodes the LZMA-packed header (a TypeScript port
of the LZMA SDK's reference decoder) and lists the files with their
sizes. An AES-encrypted header means passworded without names. Names
feed the inner name and the judge's fake rule.

An unsplit .7z of several segments now also gets a tail candidate, and
.zip files an archive candidate: their first segment's local headers
give the first entries and whether they are encrypted. Both in the Rust
edge and the TypeScript indexer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Opus 5.5 committed 2026-10-23 11:55:07 +02:00
1 parent 3b61215f6b
commit d446bb57df
25 files changed
+4840 -11

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import { test } from '@japa/runner'
import { readFileSync } from 'node:fs'
import { lzmaDecode, LzmaError } from '#lib/sevenzip/lzma'
const fixture = (name: string) => readFileSync(new URL(`../../fixtures/sevenzip/${name}`, import.meta.url))
test.group('probe / LZMA', () => {
test('decodes a stream Python made (.lzma: 5 property bytes, the size, the raw stream)', ({ assert }) => {
const alone = fixture('sample.lzma')
const expected = fixture('sample.bin')
const decoded = lzmaDecode(alone.subarray(0, 5), alone.subarray(13), expected.length)
assert.isTrue(decoded.equals(expected))
})
test('a cut-off or damaged stream throws LzmaError', ({ assert }) => {
const alone = fixture('sample.lzma')
const size = fixture('sample.bin').length
assert.throws(() => lzmaDecode(alone.subarray(0, 5), alone.subarray(13, 200), size), LzmaError)
})
})