[OpenJDK 2D-Dev] Review Request for JDK-8152672 : Exception getting thumbnail size for JPEG with embedded thumbnail
Jayathirth D V
jayathirth.d.v at oracle.com
Mon Jun 6 06:07:04 UTC 2016
Hi Jim,
When I verified by adding logs we are actually checking for EOI markers serially. I have sent detailed mail regarding the same in 2D-dev list.
I don't think that we need brute force check of EOI/SOI markers continuously without parsing the header in this case of skipImage().
Thanks,
Jay
-----Original Message-----
From: Jim Graham
Sent: Thursday, June 02, 2016 2:08 AM
To: Jayathirth D V; Philip Race
Cc: 2d-dev at openjdk.java.net
Subject: Re: Review Request for JDK-8152672 : Exception getting thumbnail size for JPEG with embedded thumbnail
I'm a little disturbed that we are just doing a basic "look for these byte value" type of search rather than parsing the file until we find an SOI. Are there cases where we are skipping arbitrary untagged data, or was this just lazy programming in the first place. Everything in a JPEG file should be tagged and the size of any arbitrary data should be known or included in the file so that we should basically be looking at the next 2 bytes, determining what kind of data follows, skipping that data, and then looking at the next tag and no amount of "we don't know what that byte was, so we'll just look at the next byte" should ever be occuring.
Am I missing something about the practical nature of the JPEG file that requires a brute force search?
...jim
On 6/1/16 12:18 AM, Jayathirth D V wrote:
> Hi,
>
>
>
> _Please review the following fix in JDK9:_
>
> _ _
>
> Bug : https://bugs.openjdk.java.net/browse/JDK-8152672
>
>
>
> Webrev : http://cr.openjdk.java.net/~jdv/8152672/webrev.00/
>
>
>
> Issue : When we are trying to get properties related to second image
> in JPEG file we are getting IIOException mentioning that it is not a JPEG file.
>
>
>
> Root cause : When we are skipping first image to reach second image
> header, we are just trying to find next available EOI marker. But if
> first image has embedded thumbnail in APP1 marker, we will reach to EOI of this thumbnail and not EOI of first image. So after we reach EOI of embedded thumbnail we try to access second image SOI marker which will fail.
>
> Solution : We have to change the logic of how we skip to consecutive
> images in JPEG file. We know that application markers, comments or
> other markers can contain data same as SOI & EOI. Instead of just checking for EOI marker serially, we should read length of these markers and skip them.
>
>
>
> Thanks,
>
> Jay
>
>
>
More information about the 2d-dev
mailing list