[OpenJDK 2D-Dev] [12] RFR JDK-8211795: ArrayIndexOutOfBoundsException in PNGImageReader after JDK-6788458

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Nov 13 22:37:17 UTC 2018


Hi, Jay.

Can you please provide some more detail about this bug.

> Root cause : In JDK-6788458 we are adding extra alpha channel for destination whenever we have tRNS chunk. But the number of bands in bitDepth scale array was not changed when we have tRNS chunk. This is causing ArrayIndexOutOfBoundsException for scale array.

As far as I understand the AIOOB is occurred when we access ps[b] at line 1308 not when we access the scale array, because the scale array is created as "scale = new int[numBands][]".  So maybe numBands should depends on the passRow? or the creation of scale[][xxx] should be updated?
BTW this code uses +1/-1 in a lot of places already, and it is not always clear why.


-- 
Best regards, Sergey.


More information about the 2d-dev mailing list