[cairo-commit] 2 commits - src/cairo-lzw.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Dec 28 04:45:27 UTC 2022
src/cairo-lzw.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 2b862f632dcc86c0a3268001508f730ff2000cd0
Merge: e1f07966a efa1e3d19
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Wed Dec 28 04:45:26 2022 +0000
Merge branch 'lzw_eod_code_width' into 'master'
Fix output of EOD code with incorrect code width in _cairo_lzw_compress
See merge request cairo/cairo!359
commit efa1e3d197696c35e70ef57f6a861a4a1cf36923
Author: Daniel Hammerschmid <daniel.hammerschmid at documatrix.com>
Date: Tue Oct 4 14:58:33 2022 +0200
Fix output of EOD code with incorrect code width in _cairo_lzw_compress
LZW compression: If the last input byte caused the code width to
increase, the end-of-data code was still output with the old (not yet
increased) code width.
diff --git a/src/cairo-lzw.c b/src/cairo-lzw.c
index f27b3c338..58e229d79 100644
--- a/src/cairo-lzw.c
+++ b/src/cairo-lzw.c
@@ -369,9 +369,6 @@ _cairo_lzw_compress (unsigned char *data, unsigned long *size_in_out)
* lookup. */
_lzw_buf_store_bits (&buf, prev, code_bits);
- if (bytes_remaining == 0)
- break;
-
LZW_SYMBOL_SET_CODE (*slot, code_next++, prev, next);
if (code_next > LZW_BITS_BOUNDARY(code_bits))
@@ -384,6 +381,9 @@ _cairo_lzw_compress (unsigned char *data, unsigned long *size_in_out)
code_next = LZW_CODE_FIRST;
}
}
+
+ if (bytes_remaining == 0)
+ break;
}
/* The LZW footer is an end-of-data code. */
More information about the cairo-commit
mailing list