From 943932c0e8a93a0522a5bc1d0839667c5db7e12e Mon Sep 17 00:00:00 2001 From: Philipp Kern Date: Thu, 11 May 2017 12:20:18 +0200 Subject: [PATCH] Fix an off-by-one error that causes memory corruption. We read up to bsize bytes from gInFile, so allocate as much memory. --- src/read.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/read.c b/src/read.c index bff5afd..2356138 100644 --- a/src/read.c +++ b/src/read.c @@ -538,7 +538,7 @@ static void read_thread(void) { pipeline_item_t *pi; queue_pop(gPipelineStartQ, (void**)&pi); io_block_t *ib = (io_block_t*)(pi->data); - block_capacity(ib, iter.block.unpadded_size, + block_capacity(ib, bsize, iter.block.uncompressed_size); ib->insize = fread(ib->input, 1, bsize, gInFile);