diff options
Diffstat (limited to 'Utilities/cmliblzma/liblzma/common/block_util.c')
-rw-r--r-- | Utilities/cmliblzma/liblzma/common/block_util.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Utilities/cmliblzma/liblzma/common/block_util.c b/Utilities/cmliblzma/liblzma/common/block_util.c index 62c9345..4cd34d1 100644 --- a/Utilities/cmliblzma/liblzma/common/block_util.c +++ b/Utilities/cmliblzma/liblzma/common/block_util.c @@ -17,11 +17,14 @@ extern LZMA_API(lzma_ret) lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) { + uint32_t container_size; + lzma_vli compressed_size; + // Validate everything but Uncompressed Size and filters. if (lzma_block_unpadded_size(block) == 0) return LZMA_PROG_ERROR; - const uint32_t container_size = block->header_size + container_size = block->header_size + lzma_check_size(block->check); // Validate that Compressed Size will be greater than zero. @@ -31,7 +34,7 @@ lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) // Calculate what Compressed Size is supposed to be. // If Compressed Size was present in Block Header, // compare that the new value matches it. - const lzma_vli compressed_size = unpadded_size - container_size; + compressed_size = unpadded_size - container_size; if (block->compressed_size != LZMA_VLI_UNKNOWN && block->compressed_size != compressed_size) return LZMA_DATA_ERROR; @@ -45,6 +48,8 @@ lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size) extern LZMA_API(lzma_vli) lzma_block_unpadded_size(const lzma_block *block) { + lzma_vli unpadded_size; + // Validate the values that we are interested in i.e. all but // Uncompressed Size and the filters. // @@ -66,7 +71,7 @@ lzma_block_unpadded_size(const lzma_block *block) return LZMA_VLI_UNKNOWN; // Calculate Unpadded Size and validate it. - const lzma_vli unpadded_size = block->compressed_size + unpadded_size = block->compressed_size + block->header_size + lzma_check_size(block->check); |