Unrar Corrupted Dictionary in Solid Archives

Solid RAR archives compress multiple files into a continuous data stream that relies on a shared sliding dictionary to achieve high compression ratios. When data corruption occurs within this dictionary or the compressed stream feeding it, the decompression engine faces broken back-references that disrupt the extraction of subsequent files. This article explains how the unrar utility detects dictionary corruption in solid archives, why the failure cascades across multiple files, and how the tool behaves during extraction attempts.

How Solid Dictionaries Work in RAR Archives

In a non-solid archive, each file is compressed independently with its own dictionary that resets upon completion. In a solid archive, the compression algorithm treats the entire set of files as one continuous sequence of bytes. The sliding dictionary—which can range from a few megabytes in RAR4 to several gigabytes in RAR5—stores recently decompressed data. Subsequent files reference byte patterns located in this shared history buffer. If File B references data patterns decompressed during the processing of File A, the integrity of File B directly depends on the exact state of File A's decompressed output.

Detection of Corrupted Dictionaries

The unrar utility does not run a dedicated "dictionary validator" prior to unpacking; instead, it detects corruption dynamically as the decompression stream is parsed:

  1. Decoding Violations: If corruption alters compressed data tokens, unrar encounters invalid Huffman codes, illegal run-lengths, or distance offsets pointing beyond the boundaries of the sliding dictionary. This immediately triggers a "Corrupt packed data" or "Checksum error" message.
  2. Checksum Failures: Each file stored in a RAR archive possesses an individual checksum (CRC32 in RAR4; CRC32 or BLAKE2sp in RAR5). Even if a corrupted dictionary reference does not crash the decompressor, the decompressed output will contain incorrect bytes, causing the file's post-extraction checksum calculation to fail.

The Cascading Failure Effect

Because a solid archive relies on an uninterrupted sliding window, dictionary corruption produces a cascading failure:

  • State Desynchronization: If byte sequence \(X\) is corrupted, the dictionary state becomes invalid. Even a single bit flip alters the sliding history buffer.
  • Loss of Downstream Files: Once the dictionary state diverges from the original state recorded at compression time, every following file that references that window will decompress into garbage data or trigger fatal decoding exceptions.
  • Reset Points: Solid archives may occasionally reset the dictionary at predefined boundaries if configured during creation, but standard solid archives maintain the chain until the entire solid block ends.

Unrar Execution Behavior and Recovery Options

When unrar encounters a corrupted dictionary during solid extraction, it behaves according to specific operational rules:

  • Default Termination: By default, when a decompression error occurs in a solid archive, unrar halts extraction for the damaged file, reports the error, and automatically deletes the partially unpacked output. For subsequent files in the same solid block, unrar will often fail immediately because the sliding history required to decode them is missing or invalid.
  • Keeping Broken Files (-kb): Supplying the -kb (Keep Broken) switch forces unrar to retain whatever data it successfully unpacked before the corruption event occurred. While this preserves partial data from the corrupted file, it does not repair the dictionary for the files that follow.
  • Recovery Records: If the archive was created with a built-in recovery record (.rev files or parity sectors embedded using Reed-Solomon codes), unrar or rar repair (rar r archive.rar) can reconstruct the missing or damaged sectors prior to extraction. This restores the raw bitstream, thereby repairing the dictionary state before the decompression pipeline ever runs.
  • Absence of Mid-Stream Resynchronization: Unlike raw audio or video streams that contain synchronization markers, solid LZ-based compression streams cannot simply "skip ahead" to the next file within a damaged solid block without the correct dictionary context. Without parity-based repair data, recovery of subsequent files dependent on that dictionary is mathematically impossible.