Hello Jay The code change looks good to me. However, I 'm not sure if we could include the test-case here.
The test case contains the Base64 encoded image in a String. To my knowledge, we cannot import images into JDK (even encoded in String) unless we are sure of the copyrights. Thanks Have a good day Prahalad ----- Original Message ----- From: Jayathirth D V Sent: Wednesday, November 08, 2017 2:23 PM To: 2d-dev Subject: [OpenJDK 2D-Dev] [10] RFR JDK-8190512: PngReader incorrectly throws IllegalArgumentException for malformed images with negative dimensions Hello All, Please review the following fix in JDK10 : Bug : https://bugs.openjdk.java.net/browse/JDK-8190512 Webrev : http://cr.openjdk.java.net/~jdv/8190512/webrev.00/ Issue : PNGImageReader throws "java.lang.IllegalArgumentException: Empty region!" when the IHDR width/height value in the header is negative. Root cause : In PNGImageReader.readHeader() we only check whether the IHDR width/height is not equal to 0(which is compliant with PNG specification), we don't check whether the value is negative or not. Solution : Although PNG specification mentions only 0 as invalid value for IHDR width/height we should also not allow IHDR width/height with negative values. Extend the check present in PNGImageReader.readHeader() to verify negative values for IHDR width and height. Thanks, Jay