How Unrar Handles Solid Archive CRC Errors
When extracting a solid RAR archive, an early CRC (Cyclic Redundancy
Check) error creates a cascading failure across subsequent files due to
the nature of solid compression. Because solid archives compress
multiple files as a single continuous data stream, the decompression of
any given file relies on the dictionary state generated by the preceding
files. When unrar encounters a corruption early in the
sequence, the decompression dictionary becomes desynchronized, causing
unrar to either abort or output corrupted versions of the
remaining files, which are routinely deleted by default unless specific
command-line flags are applied.
The Mechanics of Solid Archives
In a non-solid archive, each file is compressed independently with its own dictionary. If one file is corrupted, it has no bearing on the others.
In contrast, a solid RAR archive treats the entire file list as one continuous byte stream. The Lempel-Ziv (LZ) sliding window dictionary carries over from the end of one file to the beginning of the next. This shared dictionary allows RAR to achieve significantly higher compression ratios, particularly when archiving large numbers of similar or small files.
The Impact of an Early CRC Mismatch
A CRC error signifies that the unpacked data does not match the checksum recorded in the archive header. When this happens early in a solid archive chain, it triggers specific failure states:
- Dictionary Desynchronization: Because the decompressed output of the damaged file contains invalid data, the sliding dictionary used to decompress the next file is corrupted. Subsequent files depend on backward references pointing to specific byte sequences in the preceding files; if those sequences are altered or shifted, every following reference resolves incorrectly.
- Cascading Checksum Failures: Even if subsequent files were stored on completely undamaged sectors of the storage media, their decompressed output will almost certainly fail their respective CRC tests due to the corrupted dictionary state.
- Decompression Abortions: In many cases, the
corruption causes the decompression algorithm to encounter invalid
Huffman codes or out-of-bounds dictionary offsets. When this happens,
unrarcannot continue decoding the stream and halts execution entirely, leaving the remaining files completely unextracted.
Default Behavior and Recovery Flags
By default, when unrar encounters a CRC error during
extraction, it behaves as follows:
- File Deletion:
unrarreports a "Checksum error" or "Corrupt data" message and immediately deletes the extracted file that failed the CRC check upon finishing the attempt. - Preserving Broken Data (
-kb): If you execute the command with the-kb(Keep Broken) switch,unrarretains the extracted files despite the CRC errors. While this allows access to partially recovered data, downstream files extracted after an early CRC error will usually be unusable garbage data rather than their original contents. - Archive Repair: If the archive was created with a
recovery record, running
unrar r(orrar r) attempts to reconstruct the damaged sectors before decompression starts. If the recovery record successfully repairs the stream, the dictionary integrity is restored, andunrarextracts the entire chain without cascading errors. Without a recovery record, an early CRC error in a solid archive renders all subsequent files functionally unrecoverable.