Skip to content

Commit

Permalink
Fix buffer size check in lzs_compress()
Browse files Browse the repository at this point in the history
We were previously not actually using the last byte of the buffer.

This also makes it go faster by about 5%.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jan 9, 2015
1 parent b9b7e7a commit 84ea90e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lzs.c
Expand Up @@ -148,15 +148,15 @@ do { \
nr_outbits += (nr); \
if ((nr) > 8) { \
nr_outbits -= 8; \
dst[outpos++] = outbits >> nr_outbits; \
if (outpos >= dstlen) \
if (outpos == dstlen) \
return -EFBIG; \
dst[outpos++] = outbits >> nr_outbits; \
} \
if (nr_outbits >= 8) { \
nr_outbits -= 8; \
dst[outpos++] = outbits >> nr_outbits; \
if (outpos >= dstlen) \
if (outpos == dstlen) \
return -EFBIG; \
dst[outpos++] = outbits >> nr_outbits; \
} \
} while (0)

Expand Down

0 comments on commit 84ea90e

Please sign in to comment.