xz_header XT_FLG_CHECKSUM xz_header XT_FLG_CHECKSUM_WITH_GZIP xz_header XT_FLG_NOCRC xz_header XT_FLG_IGNORE_MISSING_SIZE xz_header XT_FLG_DICT xz_header XT_FLG_FAR xz_header XT_FLG_ALWAYS_FIND The struct xz_header is a very complex and error-prone data format thatprovides an easy way to add new features. The authors of xzip-utils seewith pleasure the fact that it is extremely easy to add new features in thecode. It's not in the standards. Should it be?
The following example is a header of a xz file used in the distribution of theParallels Workstation Extreme 6 and it illustrates a typical LZMA2header. The header length is 10 bytes and it shows how the registerw is set to 7. The first value is set by the zlib checksum and thesecond value is a checksum calculated with the formulaic, huge andunchecked switch statement. The checksum is a CRC32 over the most recent16 bytes of data, all say 0x dddddddddddddddd to make the checksum easier. Ondecompression, all data is first decoded from the end of the header to themaximum offset noted in the header, and the defaults are not changeduntil the checksum is correct; then the header is decoded in the remainingbits of the file. If there is a duplicated header (multiple identitys in the stream) the second header is ignored. Iffor some reason, the header is parsed wrongly, the decoder willignore the header, will stop decoding the data and will later printa diagnostic message. 7211a4ac4a