On Wed, 15 Feb 2023 13:18:31 GMT, Jayathirth D V <[email protected]> wrote:

> We have check in BMPImageReader, where we verify image data size using BMP 
> file size and bitmap offset value.
> But we can't rely on this calculation when we have color palette. Also color 
> palette is necessary in BMP when bits per pixel is less than 16 according to 
> BMP 
> specification(https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapv4header).
> 
> Now extra checks are added to not perform this check when we have color 
> palette or bpp is less than 16.
> 
> Also when bitsPerPixel was less than 8 it was getting down-casted to 0. So 
> this is also resolved by making this check for >=16bpp and not doing 
> (bitsPerPixel / 8)

This pull request has now been integrated.

Changeset: aa10f0d3
Author:    Jayathirth D V <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/aa10f0d3ee5d77d83950c9ed4aab11589b822ff4
Stats:     68 lines in 2 files changed: 66 ins; 0 del; 2 mod

8302151: BMPImageReader throws an exception reading BMP images

Reviewed-by: serb, tr

-------------

PR: https://git.openjdk.org/jdk/pull/12573

Reply via email to