diff options
-rw-r--r-- | Changes | 4 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | bench.c | 11 | ||||
-rw-r--r-- | lzf_c.c | 7 |
4 files changed, 17 insertions, 7 deletions
@@ -1,3 +1,7 @@ +3.5 Fri May 1 02:28:42 CEST 2009 + - lzf_compress did sometimes write one octet past the given output + buffer (analyzed and nice testcase by Salvatore Sanfilippo). + 3.4 Tue Sep 2 06:45:00 CEST 2008 - the fix from 3.3 introduced a compression bug, which is fixed in this release (which explains the mysterious prerelease...). Thanks diff --git a/Makefile.in b/Makefile.in index 8e747b2..bbd53c0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -VERSION = 3.0 +VERSION = 3.5 prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -69,18 +69,23 @@ int main(void) s=stamp(); //snprintf (buf, 64, "<1.%llx>", (unsigned long long)0xa234567812ULL); - //getpgrp(); + getpgrp(); //kill (0, SIGURG); //write (evfd, &ctr, 8); //read (evfd, &ctr, 8); //write (p[1], &buf, 1); //read (p[0], &buf, 4); //stat ("/etc/passwd", &sbuf); - free(malloc(8*1024*1024)); + //struct timeval tv; + //gettimeofday (&tv, 0); + + l = lzf_compress (data, DSIZE, data2, DSIZE*2); + assert(l); si[0]=measure(s); - //j = lzf_decompress (data2, l, data3, DSIZE*2); + j = lzf_decompress (data2, l, data3, DSIZE*2); + assert (j == DSIZE); printf ("\r%10d (%d) ", si[0], l); if (si[0] < min && si[0] > 0) @@ -170,12 +170,13 @@ lzf_compress (const void *const in_data, unsigned int in_len, unsigned int maxlen = in_end - ip - len; maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; + if (expect_false (op + 3 + 1 >= out_end)) /* first a faster conservative test */ + if (op - !lit + 3 + 1 >= out_end) /* second the exact but rare test */ + return 0; + op [- lit - 1] = lit - 1; /* stop run */ op -= !lit; /* undo run if length is zero */ - if (expect_false (op + 3 + 1 >= out_end)) - return 0; - for (;;) { if (expect_true (maxlen > 16)) |