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

Open
#292 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
43/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

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.

Written by the indexing model from the issue text.

Description

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).

Dominant language
C++
Stars
4.6k
Forks
519
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ip7z/7zip

All issues in ip7z/7zip

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.