Fix decompression with FastLZ when buffer size is less than 16 bytes

(cherry picked from commit ccf292df38)
This commit is contained in:
Haoyu Qiu 2021-07-13 16:07:42 +08:00 committed by Rémi Verschelde
parent 03f7d707e7
commit 958e1e9ae2
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -134,8 +134,9 @@ int Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p
if (p_dst_max_size < 16) { if (p_dst_max_size < 16) {
uint8_t dst[16]; uint8_t dst[16];
ret_size = fastlz_decompress(p_src, p_src_size, dst, 16); fastlz_decompress(p_src, p_src_size, dst, 16);
memcpy(p_dst, dst, p_dst_max_size); memcpy(p_dst, dst, p_dst_max_size);
ret_size = p_dst_max_size;
} else { } else {
ret_size = fastlz_decompress(p_src, p_src_size, p_dst, p_dst_max_size); ret_size = fastlz_decompress(p_src, p_src_size, p_dst, p_dst_max_size);
} }