--- old/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java 2017-12-28 15:26:34.715506000 +0530 +++ new/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java 2017-12-28 15:26:34.315306000 +0530 @@ -1086,10 +1086,20 @@ byte[] curr = new byte[bytesPerRow]; byte[] prior = new byte[bytesPerRow]; - // Create a 1-row tall Raster to hold the data - WritableRaster passRow = createRaster(passWidth, 1, inputBands, - eltsPerRow, - bitDepth); + WritableRaster passRow = null; + try { + // Create a 1-row tall Raster to hold the data + passRow = createRaster(passWidth, 1, inputBands, eltsPerRow, + bitDepth); + } catch (Exception e) { + /* + * createRaster() can throw many types of Exception but according + * to specification we must throw only IIOException if we face any + * issue while reading an image. So at this high level we catch + * the exception and wrap it around IIOException. + */ + throw new IIOException("Caught exception during read: ", e); + } // Create an array suitable for holding one pixel int[] ps = passRow.getPixel(0, 0, (int[])null);