You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2019/06/07 00:48:42 UTC
[commons-imaging] branch master updated: IMAGING-130: Ignore extra
bytes when LZW decoder table is full
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
The following commit(s) were added to refs/heads/master by this push:
new d328b7f IMAGING-130: Ignore extra bytes when LZW decoder table is full
new f8d7d2e Merge pull request #46 from mgs255/gif89a_decoding_exception
d328b7f is described below
commit d328b7f1c3c7e597f4d0c5fa9adb01f8a5a1193a
Author: Michael Sommerville <ms...@gmail.com>
AuthorDate: Wed Jun 5 12:47:06 2019 +0100
IMAGING-130: Ignore extra bytes when LZW decoder table is full
---
.../imaging/common/mylzw/MyLzwDecompressor.java | 6 +++---
src/test/data/images/gif/3/animated.gif | Bin 0 -> 1460705 bytes
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java b/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java
index bb096c6..aa05686 100644
--- a/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java
+++ b/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java
@@ -108,10 +108,10 @@ public final class MyLzwDecompressor {
if (codes < (1 << codeSize)) {
table[codes] = bytes;
codes++;
- } else {
- throw new IOException("AddStringToTable: codes: " + codes
- + " code_size: " + codeSize);
}
+ // If the table already full, then we simply ignore these bytes
+ // per the https://www.w3.org/Graphics/GIF/spec-gif89a.txt 'spec'.
+
checkCodeSize();
}
diff --git a/src/test/data/images/gif/3/animated.gif b/src/test/data/images/gif/3/animated.gif
new file mode 100644
index 0000000..6d664c7
Binary files /dev/null and b/src/test/data/images/gif/3/animated.gif differ