dump.f2fs: compress: fix dstlen of LZ4_compress_fast_extState()
PATCH 1/1 dump.f2fs: compress: fix dstlen of LZ4_compress_fast_extState()
Compressed cluster content includes compress cluster header, so calculation of dstlen parameter in LZ4_compress_fast_extState() should consider this design, otherwise compressed data may overflow destination buffer during compression.
Signed-off-by Chao Yu <[email protected]>
--- fsck/compress.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fsck/compress.c +2 -1
@@ -86,7 +86,8 @@ static int lz4_compress(struct compress_ctx *cc) { cc->clen =LZ4_compress_fast_extState (cc->private, cc->rbuf, (char *)cc->cbuf->cdata, cc->rlen, - cc->rlen -F2FS_BLKSIZE * c.compress.min_blocks, + cc->rlen -F2FS_BLKSIZE * c.compress.min_blocks - +COMPRESS_HEADER_SIZE ,LZ4_ACCELERATION_DEFAULT );if (!cc->clen)
Signature · 8 lines
2.32.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel