You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Fabian Meumertzheim (Jira)" <ji...@apache.org> on 2021/01/14 09:20:00 UTC
[jira] [Created] (IMAGING-277) ArrayIndexOutOfBoundsException in
MyLzwDecompressor
Fabian Meumertzheim created IMAGING-277:
-------------------------------------------
Summary: ArrayIndexOutOfBoundsException in MyLzwDecompressor
Key: IMAGING-277
URL: https://issues.apache.org/jira/browse/IMAGING-277
Project: Commons Imaging
Issue Type: Bug
Components: Format: GIF
Affects Versions: 1.0-alpha2
Reporter: Fabian Meumertzheim
The following Java snippet crashes with an ArrayIndexOutOfBoundsException:
{code:java}
import java.io.IOException;
import java.util.Base64;
import java.util.HashMap;
import org.apache.commons.imaging.ImageReadException;
import org.apache.commons.imaging.common.bytesource.ByteSourceArray;
import org.apache.commons.imaging.formats.gif.GifImageParser;
public class GifImageParserCrash1 {
public static byte[] btoa(String base64) {
return Base64.getDecoder().decode(base64);
}
public static void main(String[] args) {
byte[] input = btoa("SQAACklJAPVPAAIKACy3LAACAP8JAAD4AA==");
try {
new GifImageParser().getBufferedImage(new ByteSourceArray(input), new HashMap<>());
} catch (IOException | ImageReadException e) {}
}
}
{code}
The stack trace is:
{noformat}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 4096 out of bounds for length 4096
at org.apache.commons.imaging.common.mylzw.MyLzwDecompressor.initializeTable(MyLzwDecompressor.java:72)
at org.apache.commons.imaging.common.mylzw.MyLzwDecompressor.<init>(MyLzwDecompressor.java:63)
at org.apache.commons.imaging.common.mylzw.MyLzwDecompressor.<init>(MyLzwDecompressor.java:45)
at org.apache.commons.imaging.formats.gif.GifImageParser.readImageDescriptor(GifImageParser.java:395)
at org.apache.commons.imaging.formats.gif.GifImageParser.readBlocks(GifImageParser.java:261)
at org.apache.commons.imaging.formats.gif.GifImageParser.readFile(GifImageParser.java:475)
at org.apache.commons.imaging.formats.gif.GifImageParser.readFile(GifImageParser.java:459)
at org.apache.commons.imaging.formats.gif.GifImageParser.getBufferedImage(GifImageParser.java:840)
at GifImageParserCrash1.main(GifImageParserCrash1.java:17)
{noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)