coobird / thumbnailator

Thumbnailator - a thumbnail generation library for Java
MIT License
5.14k stars 785 forks source link

GIF java.lang.ArrayIndexOutOfBoundsException: 4096 #120

Closed snaquekiller closed 6 years ago

snaquekiller commented 7 years ago

Expected behavior

Please describe what you are expecting the library to perform. create thumbnail

Actual behavior

Please describe the actual behavior you are experiencing, including stack trace and other information which would help diagnose the issue.

 java.lang.ArrayIndexOutOfBoundsException: 4096
    at com.sun.imageio.plugins.gif.GIFImageReader.read(GIFImageReader.java:984)
at net.coobird.thumbnailator.tasks.io.FileImageSource.read(Unknown Source)
    at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.read(Unknown Source)
at net.coobird.thumbnailator.Thumbnailator.createThumbnail(Unknown Source)
    at net.coobird.thumbnailator.Thumbnails$Builder.toOutputStream(Unknown Source)

Steps to reproduce the behavior

Please enter step-by-step instructions for reproducing the actual behavior. Including code can be helpful in diagnosing issue, but please keep the code to a minimal that will reproduce the behavior. 200_002 10 try to create thumbnail of this two gif

Environment

Please provide vendor and version information for the Operating System, JDK, and Thumbnailator. Please feel free to add any other information which may be pertinent.

coobird commented 7 years ago

@snaquekiller, sorry for the late reply.

I'd like to get clarification on your issue -- what are your expectations? You'll need to be more clear about what you expect.

I'm going to guess that you want to resize an animated GIF?

gssitrainee commented 6 years ago

Same problem here

freehuoshan commented 6 years ago

sample problem

java.lang.ArrayIndexOutOfBoundsException: 4096 at com.sun.imageio.plugins.gif.GIFImageReader.read(GIFImageReader.java:984) ~[na:1.8.0_60] at net.coobird.thumbnailator.tasks.io.InputStreamImageSource.read(Unknown Source) ~[thumbnailator-0.4.8.jar!/:0.4.8] at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.read(Unknown Source) ~[thumbnailator-0.4.8.jar!/:0.4.8] at net.coobird.thumbnailator.Thumbnailator.createThumbnail(Unknown Source) ~[thumbnailator-0.4.8.jar!/:0.4.8] at net.coobird.thumbnailator.Thumbnails$Builder.toOutputStream(Unknown Source) ~[thumbnailator-0.4.8.jar!/:0.4.8] at com.github.tobato.fastdfs.service.DefaultFastFileStorageClient.getThumbImageStream(DefaultFastFileStorageClient.java:185) ~[fastdfs-client-1.25.4-RELEASE.jar!/:1.25.4-RELEASE] at com.github.tobato.fastdfs.service.DefaultFastFileStorageClient.uploadThumbImage(DefaultFastFileStorageClient.java:154) ~[fastdfs-client-1.25.4-RELEASE.jar!/:1.25.4-RELEASE]

freehuoshan commented 6 years ago

https://github.com/DhyanB/Open-Imaging

I found a solution here, please solve this bug in the new version.

coobird commented 6 years ago

@freehuoshan , thank you for adding more information about this issue.

So this is an issue that the GIF decoder bundled with the JRE, and can be found discussed here: https://stackoverflow.com/questions/22259714/arrayindexoutofboundsexception-4096-while-reading-gif-file

Since Thumbnailator relies on the image readers and writers provided by Java Image I/O, providing bug fixes for those are out of scope of this project. I'm going to close this, as it's not a problem with Thumbnailator itself.