Closed pete4abw closed 1 year ago
The following APIs let you compress buffers of size greater than 2GB:
/**
* @brief Compress a block of data. This function does not support parallelism
* by itself, consider using the low level `bz3_encode_blocks()` function instead.
* Using the low level API might provide better performance.
* Returns a bzip3 error code; BZ3_OK when the operation is successful.
* Make sure to set out_size to the size of the output buffer before the operation;
* out_size must be at least equal to `bz3_bound(in_size)'.
*/
BZIP3_API int bz3_compress(uint32_t block_size, const uint8_t * in, uint8_t * out, size_t in_size, size_t * out_size);
/**
* @brief Decompress a block of data. This function does not support parallelism
* by itself, consider using the low level `bz3_decode_blocks()` function instad.
* Using the low level API might provide better performance.
* Returns a bzip3 error code; BZ3_OK when the operation is successful.
* Make sure to set out_size to the size of the output buffer before the operation.
*/
BZIP3_API int bz3_decompress(const uint8_t * in, uint8_t * out, size_t in_size, size_t * out_size);
The following APIs let you compress buffers of size greater than 2GB:
Not sure this helps. The high level APIs call
bz3_en/decode_block
which are called directly fromlrzip-next
. I'm just concerned with the possible dt mismatch. Is this an issue or not?
No action
lrzip-next Version
0.9.3
lrzip-next command line
N/A
What happened?
bzip3 expects size data to be compressed and returns size of compressed to be int32_t yet
lrzip-next
cthread structure stores compressed and uncompressed data sizes as int64_t. While unlikely that the size of a single block will exceed 2GB, it is not impossible,lrzip-next
supports only 64-bit processors now. For bzip3 to work consistently, either type casting or error checking has to be introduced. It appears bzip2 compression/decompression may also be impacted, although it appears to use uint32_t. Some re-evaluation of the use of int64_t in compression/decompression may need to be done.What was expected behavior?
No data type mismatches
Steps to reproduce
Review source in lrzip_private.h, stream.c.
Relevant log output
No response
Please provide system details
64 bit systems
Additional Context
Type matching is important to prevent possible data overflows.