Skip to content

Commit

Permalink
Fixed a false buffer overrun condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesc Alted committed Mar 20, 2014
1 parent e4226e0 commit ef311ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions blosc/blosc.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ static int blosc_c(int32_t blocksize, int32_t leftoverblock,
return -5; /* signals no compression support */
}

if (cbytes >= maxout) {
if (cbytes > maxout) {
/* Buffer overrun caused by compression (should never happen) */
return -1;
}
Expand All @@ -536,7 +536,7 @@ static int blosc_c(int32_t blocksize, int32_t leftoverblock,
return -2;
}
else if (cbytes == 0) {
/* The compressor has been unable to compress data significantly. */
/* The compressor has been unable to compress data at all. */
/* Before doing the copy, check that we are not running into a
buffer overflow. */
if ((ntbytes+neblock) > maxbytes) {
Expand Down

0 comments on commit ef311ed

Please sign in to comment.