Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
P3
-
Resolution: Fixed
-
Affects Version/s: 11, 12
-
Fix Version/s: 12
-
Component/s: client-libs
-
Subcomponent:
-
Resolved In Build:b23
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8285899 | 11.0.16 | Martin Doerr | P3 | Resolved | Fixed | b01 |
Description
The fix for JDK-6788458 causes PNGImageReader to throw an ArrayIndexOutOfBoundsException reading some pngs that it previously accepted.
===
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class Image {
public static void main(String[] args) throws IOException {
BufferedImage image = ImageIO.read(new File(args[0]));
ImageIO.write(image, "PNG", new File(args[1]));
}
}
===
$ javac image.java
$ java Image add_white.png output.png
...
Exception in thread "main" javax.imageio.IIOException: Caught exception during read:
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1817)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1468)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1315)
at Image.main(Image.java:8)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.decodePass(PNGImageReader.java:1308)
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.decodeImage(PNGImageReader.java:1360)
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1493)
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1810)
... 3 more
===
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class Image {
public static void main(String[] args) throws IOException {
BufferedImage image = ImageIO.read(new File(args[0]));
ImageIO.write(image, "PNG", new File(args[1]));
}
}
===
$ javac image.java
$ java Image add_white.png output.png
...
Exception in thread "main" javax.imageio.IIOException: Caught exception during read:
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1817)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1468)
at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1315)
at Image.main(Image.java:8)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.decodePass(PNGImageReader.java:1308)
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.decodeImage(PNGImageReader.java:1360)
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1493)
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1810)
... 3 more
Attachments
Issue Links
- backported by
-
JDK-8285899 ArrayIndexOutOfBoundsException in PNGImageReader after JDK-6788458
-
- Resolved
-
- relates to
-
JDK-6788458 PNGImageReader ignores tRNS chunk while reading non-indexed RGB/Gray images
-
- Resolved
-