7z reader rejects single-byte filter IDs 04–09 listed in DOC/Methods.txt ("Unsupported Method"), while 0A/0B and the long 0303xxxx IDs work

Aperta
#292 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
43/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
backend

Direzione di ricerca

Read DOC/Methods.txt alongside CPP/7zip/Compress/BcjRegister.cpp and BranchRegister.cpp to compare the documented IDs with the registered coder IDs. Reproduce with the provided f04.7z steps, then check decoding for IDs 04–09. Done means confirming whether those IDs are intended for .7z and either matching the registrations to that behavior or correcting the documentation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment
  • 7-Zip (z) 26.06 (arm64), ip7z/7zip @ d3296e3, macOS 26.4.1 arm64
Description

DOC/Methods.txt says "xz and 7z formats use same ID map." Its "List of defined IDs" contains:

00 - Copy
03 - Delta
04 - BCJ (x86)
05 - PPC (big-endian)
06 - IA64
07 - ARM (little-endian)
08 - ARMT (little-endian)
09 - SPARC
0A - ARM64
0B - RISCV

In a .7z archive, a folder that uses filter ID 0A or 0B decodes correctly. A folder that uses 04, 05, 06, 07, 08 or 09 fails with ERROR: Unsupported Method. The same filters work under their long IDs (03030103 BCJ, 03030205 PPC, 03030401 IA64, 03030501 ARM, 03030701 ARMT, 03030805 SPARC). 7zz i lists BCJ/PPC/IA64/ARM/ARMT/SPARC only under the long IDs.

Steps to reproduce

A 203-byte archive with one 100-byte ASCII file a.txt in a folder [Copy, filter 04] (the BCJ x86 filter leaves this data unchanged):

cat > f04.b64 <<'EOF'
N3q8ryccAAQtnxkmZAAAAAAAAABHAAAAAAAAANfmRydhLnR4dHwxO2EudHh0fDE7YS50eHR8MTthLnR4dHwxO2EudHh0fDE7YS50eHR8MTthLnR4dHwxO2EudHh0fDE7YS50eHR8MTthLnR4dHwxO2EudHh0fDE7YS50eHR8MTthLnR4AQQGAAEJZAAHCwEAAgEEAQAAAQxkZAAICgFOv4J6AAAFARENAGEALgB0AHgAdAAAABQKAQAAgKYhyYnWARUGAQAgAAAAAAA=
EOF
base64 -d < f04.b64 > f04.7z      # works with GNU and macOS base64
7zz l -slt f04.7z | grep Method   # Method = Copy 04
7zz t f04.7z; echo "rc=$?"         # ERROR: Unsupported Method : a.txt   rc=2

If the coder ID byte 04 is changed to 0A (ARM64) and the header CRCs are recomputed, 7zz t reports Everything is Ok. The same failure occurs for IDs 05–09, with LZMA2 instead of Copy, for solid and non-solid archives, and when the filter is used as the header coder (the archive then cannot be opened).

Root cause (analysis on d3296e3)
  • CPP/7zip/Compress/BcjRegister.cpp:15 registers BCJ only as 0x3030103.
  • CPP/7zip/Compress/BranchRegister.cpp:31-43 registers PPC/IA64/ARM/ARMT/SPARC only as 0x3030000 + id.
  • Only ARM64 and RISCV are registered with their single-byte IDs (BranchRegister.cpp:55-56: 0xa, 0xb).
  • The single-byte IDs 04–09 exist only inside the xz handler (C/Xz.h:14-19, XZ_ID_X86 … XZ_ID_SPARC).
Question / suggested resolution

Are IDs 04–09 meant to be valid in .7z archives?

  • If yes: register the branch filters under both IDs for decoding.
  • If no: state in Methods.txt that 04–09 are xz-only, and that .7z uses 03030103 etc. for these filters, as it does for ARM64/RISCV with 0A/0B.

Found with a differential test setup (a model of the documented behavior compared against the real binary) and then checked by hand: every command above was re-run verbatim on the tested build, and the root cause was read in the source. Tested commit: d3296e3 (26.06).

Lingua principale
C++
Stelle
4.6k
Fork
519
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ip7z/7zip

Tutte le issue di ip7z/7zip

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.