summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2018-12-12 12:46:44 +1300
committerRobert Ancell <robert.ancell@canonical.com>2019-01-16 15:47:09 +1300
commit88ceed9ed1e823ffd797df798d429d15bc7efd39 (patch)
treedf02ce09e148825988eeb175528925148baefb25
parentb9b12bfd5c6f8394cc9a4a548bd6dc0f5fb2f70b (diff)
downloadgdk-pixbuf-88ceed9ed1e823ffd797df798d429d15bc7efd39.tar.gz
gif: Fix clear code handling when at end of a block
The following was occurring: 1. A clear code is detected in the LZW stream. 2. The decoder enters a clear code handling state. 3. The decoder looks for the next code after the clear. 4. The decoder has run out of blocks, so enters a state to get new blocks The issue is in step 4 the decoder has assumed the clear state is complete, when it is not. The solution is to only complete the clear state once a non clear code is read. This caused the "Circular table entry in GIF file" error for some GIFs. Fixes https://gitlab.gnome.org/GNOME/gdk-pixbuf/issues/27 Fixes https://gitlab.gnome.org/GNOME/gdk-pixbuf/issues/69
-rw-r--r--gdk-pixbuf/io-gif.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c
index 244d8788f..f2207360e 100644
--- a/gdk-pixbuf/io-gif.c
+++ b/gdk-pixbuf/io-gif.c
@@ -572,7 +572,6 @@ lzw_read_byte (GifContext *context)
register int i;
if (context->lzw_fresh) {
- context->lzw_fresh = FALSE;
do {
retval = get_code (context, context->lzw_code_size);
if (retval < 0) {
@@ -581,6 +580,7 @@ lzw_read_byte (GifContext *context)
context->lzw_firstcode = context->lzw_oldcode = retval;
} while (context->lzw_firstcode == context->lzw_clear_code);
+ context->lzw_fresh = FALSE;
return context->lzw_firstcode;
}