From 06afde5c45b58dd20a366d3dcb85d7e6fd702096 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Tue, 4 Dec 2018 12:31:37 +1300 Subject: gif: Fix off by one error in LZW decoder The following was occurring: 1. Code words would be read from the LZW data blocks. 2. If there was exactly enough space for one more codeword in the block, more blocks were read. This is the off by one error. It should have read the last code before doing this. 3. If the next block was the terminating block the code would be marked as complete. 4. Another block would be attempted to be read, because the decoder was still in the same state as step 2. 5. An error was generated because the decoder was trying to read blocks after it had determined the stream had ended. This fixes the GIF decoder failing to decode images without an end-of-information code. --- tests/test-images/gif-test-suite/TESTS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test-images/gif-test-suite/TESTS b/tests/test-images/gif-test-suite/TESTS index 2dfc87aee..cc986661e 100644 --- a/tests/test-images/gif-test-suite/TESTS +++ b/tests/test-images/gif-test-suite/TESTS @@ -31,8 +31,8 @@ missing-pixels extra-pixels extra-data no-clear -#no-eoi -#no-clear-and-eoi +no-eoi +no-clear-and-eoi #many-clears #double-clears invalid-colors -- cgit v1.2.1