question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LZWDecoder - IndexOutOfBoundsException when reading some files

See original GitHub issue

When attempting to read and write certain grayscale tiffs, the following happens

  1. The resulting image is always corrupted
  2. Sometimes, an IndexOutOfBoundsException exception is raised when the LZWDecoder is is invoked via a call to com.twelvemonkeys.imageio.plugins.tiff.TIFFImageReader.read . This doesn’t always happen. I needed to run the test class a few times to see the exception.

Some files don’t have this issue, others do . See the code and test files for details

Thanks

test_and_data.zip

Exception details Exception in thread "main" java.lang.IndexOutOfBoundsException at java.nio.Buffer.checkIndex(Buffer.java:532) at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:172) at com.twelvemonkeys.imageio.plugins.tiff.LZWDecoder$LZWString.writeTo(LZWDecoder.java:330) at com.twelvemonkeys.imageio.plugins.tiff.LZWDecoder.decode(LZWDecoder.java:129) at com.twelvemonkeys.io.enc.DecoderStream.fill(DecoderStream.java:178) at com.twelvemonkeys.io.enc.DecoderStream.read(DecoderStream.java:122) at com.twelvemonkeys.io.LittleEndianDataInputStream.readFully(LittleEndianDataInputStream.java:423) at com.twelvemonkeys.io.LittleEndianDataInputStream.readFully(LittleEndianDataInputStream.java:396) at com.twelvemonkeys.imageio.plugins.tiff.TIFFImageReader.readStripTileData(TIFFImageReader.java:1417) at com.twelvemonkeys.imageio.plugins.tiff.TIFFImageReader.read(TIFFImageReader.java:931) at javax.imageio.ImageIO.read(ImageIO.java:1448) at javax.imageio.ImageIO.read(ImageIO.java:1308) at ImagingIssue.main(ImagingIssue.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
haraldkcommented, Jul 26, 2016

Thanks!

I need to look into this some more when I find the time, but it looks like there’s a problem with the LZW decoding.

Harald K

0reactions
haraldkcommented, Nov 3, 2016

@balamuru This bugfix is now included in the official 3.3 release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - IndexOutOfBoundsException when reading CSV file
CSV File. And i'm trying to read it and add it to an array with this code: ArrayListlistaProductos2 = new ArrayList();
Read more >
TwelveMonkeys changelog - Awesome Java
#268 TIFFImageReader: Reading with source region is broken for JPEG-in-TIFF raster case #272 LZWDecoder - IndexOutOfBoundsException when reading some files
Read more >
JDK-8159434 C2 Compiler causes ... - Bug ID
Edit some Java source files, while the Java compiler compliance level is set to 1.8, with the default compliance settings (see Window >...
Read more >
iText Knowledge Base
How to only read text from a constant location on PDF pages? How do I read only a specific part of each PDF...
Read more >
Browse iText 5 Java / itextpdf - iText Bitbucket
File FloatLayout.java · 1) Added tagged DIV element support 2) Fixed "incorrect reading order" problem on some PDF documents, 03 Jan 2013.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found