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

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Mon Oct 5 13:31:09 UTC 2015


Hi, Jay.
The fix looks fine to me.

On 05.10.15 13:17, Jayathirth D v wrote:
> Hello All,
>
> _Please review following fix in jdk9:_
>
> _Bug:_ https://bugs.openjdk.java.net/browse/JDK-8066904/
>
> _Webrev:_
> <http://cr.openjdk.java.net/%7Erchamyal/jay/8066904/webrev.00/>http://cr.openjdk.java.net/~rchamyal/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


-- 
Best regards, Sergey.



More information about the 2d-dev mailing list