[cairo-commit] 2 commits - src/cairo-lzw.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 28 09:55:39 UTC 2022


 src/cairo-lzw.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 394256abbadd79223332532ca6e376b86b13f1e8
Merge: 9b2e6f199 bd15b6290
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Wed Dec 28 09:55:37 2022 +0000

    Merge branch 'lzw-compress-1-byte' into 'master'
    
    Fixed crash in _cairo_lzw_compress for 1 byte input
    
    See merge request cairo/cairo!376

commit bd15b629060a0bba6d6f101aca1d590292018e28
Author: Daniel Hammerschmid <daniel.hammerschmid at documatrix.com>
Date:   Wed Dec 28 10:16:49 2022 +0100

    Fixed crash in _cairo_lzw_compress for 1 byte input

diff --git a/src/cairo-lzw.c b/src/cairo-lzw.c
index 58e229d79..e17cdfc1c 100644
--- a/src/cairo-lzw.c
+++ b/src/cairo-lzw.c
@@ -369,7 +369,10 @@ _cairo_lzw_compress (unsigned char *data, unsigned long *size_in_out)
 	 * lookup. */
 	_lzw_buf_store_bits (&buf, prev, code_bits);
 
-	LZW_SYMBOL_SET_CODE (*slot, code_next++, prev, next);
+	if (likely (slot != NULL))
+	    LZW_SYMBOL_SET_CODE (*slot, code_next, prev, next);
+
+	code_next++;
 
 	if (code_next > LZW_BITS_BOUNDARY(code_bits))
 	{


More information about the cairo-commit mailing list