Skip to content

Commit

Permalink
Fix an off-by-one error that causes memory corruption.
Browse files Browse the repository at this point in the history
We read up to bsize bytes from gInFile, so allocate as much memory.
  • Loading branch information
pkern committed May 11, 2017
1 parent 75f27d8 commit 943932c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 943932c

Please sign in to comment.