diff options
author | root <root> | 2009-05-01 00:30:53 +0000 |
---|---|---|
committer | root <root> | 2009-05-01 00:30:53 +0000 |
commit | e60815be290c2334e9122b10ac53b92b23e7f9a3 (patch) | |
tree | 7f9d8726a2bea476f2b731dec0eae23db48136b4 /lzf_c.c | |
parent | 2765a97bc918b1ea0c8aff8c66535d34c01a8998 (diff) |
3.5rel-3_5
Diffstat (limited to 'lzf_c.c')
-rw-r--r-- | lzf_c.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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)) |