Hi Brian,

 

Thanks for your inputs.

I have updated the new bug https://bugs.openjdk.java.net/browse/JDK-8160327 
with same comment.

 

Thanks,

Jay

 

From: Brian Burkhalter 
Sent: Tuesday, June 28, 2016 12:41 AM
To: Philip Race
Cc: Jayathirth D V; 2d-dev@openjdk.java.net
Subject: Re: [OpenJDK 2D-Dev] Review Request for JDK-8152672 : Exception while 
getting second image properties for JPEG with embedded thumbnail

 

The procedure for this is straightforward:

 

Inside the APP1 Exif marker segment locate the 8-byte TIFF header.
>From the last four bytes of the TIFF header obtain the offset to the 0th Image 
>File Descriptor (IFD).
Skip all the entries in the 0th IFD.
Obtain from the last four bytes of the 0th IFD the offset to the 1st IFD.
If the offset to the 1st IFD is zero, there is no thumbnail; otherwise seek to 
the offset of the 1st IFD.
Within the 1st IFD locate and obtain the values of the two entries with tags 
JPEGInterchangeFormat and JPEGInterchangeFormatLength. These provide 
respectively the offset to the SOI marker segment of the Exif thumbnail and the 
length of the Exif thumbnail data. If both of these entries are missing, then 
the file is aberrant and no thumbnail can be read. If only the 
JPEGInterchangeFormat entry is present, the thumbnail is likely still readable 
assuming it has the proper JPEG structure including a terminating EOI marker 
segment.
Seek to the value of the JPEGInterchangeFormat entry and decode the thumbnail. 
(It might not be a bad safeguard if possible to check that the two bytes at 
offset JPEGInterchangeFormat + JPEGInterchangeFormatLength - 2 are actually an 
EOI marker.)

 

It might not be a bad idea to add the above as a comment in the issue to be 
filed.

 

Brian

 

On Jun 25, 2016, at 9:57 AM, Philip Race <HYPERLINK 
"mailto:philip.r...@oracle.com"philip.r...@oracle.com> wrote:





- A follow-on bug should be filed that we do not locate thumbnails
inside EXIF APP1 markers. We do not need to parse everything inside
the APP1 marker to do this so it should be a moderate but not
massive amount of work.

 

Reply via email to