[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 08:52:58 UTC 2017


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

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20171108/d5f7a80f/attachment.html>


More information about the 2d-dev mailing list