Abnormal Scenarios of Using KAEZlib Block Decompression APIs
The KAEZlib module provides some compression and decompression APIs compatible with the open source zlib library, including the deflate and inflate APIs for stream processing and the compress and uncompress APIs for block processing.
When the uncompress API is called, the capacity of the destination buffer must be passed as a parameter. This means that the caller must ensure that the capacity of the destination buffer is greater than the amount of decompressed data. If the capacity of the destination buffer is insufficient, the decompression operation may trigger undefined behavior, causing unpredictable program running results.
Therefore, if the size of the original data is unknown, you are advised to use the stream decompression mode (inflate). If the block decompression API (uncompress) must be used, you must ensure a sufficient buffer capacity.