aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs')
-rw-r--r--lib/sqfs/comp/lzma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqfs/comp/lzma.c b/lib/sqfs/comp/lzma.c
index 82590c7..9fc507f 100644
--- a/lib/sqfs/comp/lzma.c
+++ b/lib/sqfs/comp/lzma.c
@@ -69,6 +69,9 @@ static ssize_t lzma_comp_block(sqfs_compressor_t *base, const uint8_t *in,
if (ret != LZMA_STREAM_END)
return ret == LZMA_OK ? 0 : SQFS_ERROR_COMRPESSOR;
+ if (strm.total_out > size)
+ return 0;
+
out[LZMA_SIZE_OFFSET ] = size & 0xFF;
out[LZMA_SIZE_OFFSET + 1] = (size >> 8) & 0xFF;
out[LZMA_SIZE_OFFSET + 2] = (size >> 16) & 0xFF;