[OpenJDK 2D-Dev] [10] RFR JDK-8190512: PngReader incorrectly throws IllegalArgumentException for malformed images with negative dimensions
Jayathirth D V
jayathirth.d.v at oracle.com
Wed Nov 8 10:35:59 UTC 2017
Hi Prahalad,
Thanks for your review.
I remember using byteArray from test case in JBS previously for one of the fix so I searched for the same : https://bugs.openjdk.java.net/browse/JDK-8066904 . This is one of the initial issues that I worked on.
I also see that you recently didn't include submitter test case for some of BMP issues like https://bugs.openjdk.java.net/browse/JDK-6852563 & https://bugs.openjdk.java.net/browse/JDK-8167278
I would like to get inputs from others also so that we can decide to use or not to use the encoded string for image information from submitter in the JDK.
Regards,
Jay
-----Original Message-----
From: Prahalad Kumar Narayanan
Sent: Wednesday, November 08, 2017 3:16 PM
To: Jayathirth D V; 2d-dev
Subject: RE: [OpenJDK 2D-Dev] [10] RFR JDK-8190512: PngReader incorrectly throws IllegalArgumentException for malformed images with negative dimensions
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
More information about the 2d-dev
mailing list