RFR: 8274735: javax.imageio.IIOException: Unsupported Image Type while processing a valid JPEG image [v2]

Phil Race prr at openjdk.java.net
Thu Mar 24 18:13:43 UTC 2022


On Thu, 24 Mar 2022 07:50:59 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> yes
>
> As far as I understand the in the read code we create a DataBufferByte so later we can use the cast. But in this method we do not create it, and use what the user provide to us, can the user "craft custom " raster/metadata and the cs type?

Yes we do. This raster is created here in the ImageWriter as follows 

        // Create an appropriate 1-line databuffer for writing
        int lineSize = sourceWidth*numBandsUsed;

        DataBufferByte buffer = new DataBufferByte(lineSize);

        // Create a raster from that
        int [] bandOffs = JPEG.bandOffsets[numBandsUsed-1];

        raster = Raster.createInterleavedRaster(buffer,
                                                sourceWidth, 1,
                                                lineSize,
                                                numBandsUsed,
                                                bandOffs,
                                                null);

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

PR: https://git.openjdk.java.net/jdk/pull/7849



More information about the client-libs-dev mailing list