Skip to content

Handle bvx2 LZFSE blocks in IWA decompression#1

Open
AirRunner wants to merge 1 commit into
6over3:mainfrom
AirRunner:main
Open

Handle bvx2 LZFSE blocks in IWA decompression#1
AirRunner wants to merge 1 commit into
6over3:mainfrom
AirRunner:main

Conversation

@AirRunner

Copy link
Copy Markdown

Problem

Numbers Creator Studio can write OperationStorage.iwa using bvx2 (LZFSE) framing instead of bvxn (LZVN). The previous code matched only the 4-byte bvxn magic, so any IWA starting with bvx2 fell through to decompressSnappyChunks and raised invalidIWAHeader(expected: 0, found: 98).

Fix

Match the shared 3-byte bvx prefix instead of the 4-byte bvxn magic. All LZFSE block types (bvxn, bvx2, bvx-, bvx$) share this prefix, so the existing decompressLZFSE() (which delegates to compression_decode_buffer) handles them all correctly without further changes.

Verification

Confirmed against a real-world Numbers 15.2.1 file whose OperationStorage.iwa starts with bvx2 ([0x62, 0x76, 0x78, 0x32]). Parsing succeeds after this change.

OperationStorage.iwa stores the document's operation history. Numbers may switch from bvxn to bvx2 as that history grows, which would explain why the issue doesn't surface on fresh files.

Numbers Creator Studio can write bvx2 (LZFSE) instead of bvxn (LZVN) for OperationStorage.iwa. Matching the 3-byte bvx prefix instead of the 4-byte bvxn magic routes all LZFSE variants to decompressLZFSE(), which handles them correctly via compression_decode_buffer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant