RFR: 8278086: [REDO] ImageIO.write() method will throw IndexOutOfBoundsException [v2]
Jayathirth D V
jdv at openjdk.org
Mon Oct 3 06:43:20 UTC 2022
On Fri, 30 Sep 2022 20:50:15 GMT, Phil Race <prr at openjdk.org> wrote:
>> Jayathirth D V has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove biType variable
>
> src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java line 1463:
>
>> 1461: return false;
>> 1462: }
>> 1463: if (compressionType == BI_RLE4 && bpp != 4) {
>
> I'm confused. You say you are relaxing the test to allow 15bpp, but I don't see where you're removing
> anything that would have rejected 15bpp.
>
> And how does this prevent the un-specified exception being thrown ?
Hi Phil,
We never had any bpp check to verify what standard bpp's should be allowed in BMP.
Because of this when we tried to decode 2 bpp PNG img and write it to BMP we used to get IOOBE as captured in https://bugs.openjdk.org/browse/JDK-8262297. So under this bug, check was added to allow only standard bpp's for BMP encoding : https://github.com/openjdk/jdk/commit/c73319354399596ab2b9aab0a7f62e8fa0ab9365.
But this caused regression of many jtreg tests which were using USHORT_555_RGB to encode BMP image(we round off this 15bpp to 16bpp and at later stage : https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java#L472 and store it in 16bit data buffer). So i relaxed this check which caused jtreg regressions to allow 15bpp also.
-------------
PR: https://git.openjdk.org/jdk/pull/10419
More information about the client-libs-dev
mailing list