[OpenJDK 2D-Dev] <OpenJDK 2D-Dev> Review request for JDK-8066904: NullPointerExcpetion when calling ImageIO.read() with corrupt BMP

Jayathirth D v jayathirth.d.v at oracle.com
Mon Oct 5 10:17:02 UTC 2015


Hello All,

_Please review following fix in jdk9:_

_Bug:_ https://bugs.openjdk.java.net/browse/JDK-8066904/

_Webrev:_ http://cr.openjdk.java.net/~rchamyal/jay/8066904/webrev.00/ 
<http://cr.openjdk.java.net/%7Erchamyal/jay/8066904/webrev.00/>

_Bug:_ NullPointerException when calling ImageIO.read(InputStream) with 
corrupt BMP

_Root cause:_ Bits per pixel is zero in BMP header and because of which 
sampleModel & colorModel are set to null in readHeader() of 
BMPImageReader.java. This is causing "bdata" to be null in 
read(imageIndex, ImageReadParam) which is referenced later.

_Solution:_ Bits per pixel cant be zero for BI_RGB compression type(no 
compression). Cases where Bits per pixel is not supported needs to be 
handled properly. So caught exceptions at relevant places.

Thanks,
Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20151005/6f531079/attachment.html>


More information about the 2d-dev mailing list