[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    [OpenJDK 2D-Dev] [12] RFR JDK-8211422: Reading PNG with corrupt CRC for IEND chunk throws IIOExcepti
From:       Jayathirth Rao <jayathirth.d.v () oracle ! com>
Date:       2018-10-23 13:50:41
Message-ID: F91AE446-ED6D-4DA6-8ED4-1705BB35962F () oracle ! com
[Download RAW message or body]

Hello All,
 
Please review the following fix in JDK12:
 
Bug : https://bugs.openjdk.java.net/browse/JDK-8211422 \
<https://bugs.openjdk.java.net/browse/JDK-8211422>   
Webrev: http://cr.openjdk.java.net/~jdv/8211422/webrev.00/ \
<http://cr.openjdk.java.net/~jdv/8211422/webrev.00/>   
Issue : When we try to read PNG image with corrupt/no 4 byte CRC data for IEND chunk \
we throw IIOException. We see this issue only after JDK-8164971 \
<https://bugs.openjdk.java.net/browse/JDK-8164971>.  
Root cause : In JDK-8164971 <https://bugs.openjdk.java.net/browse/JDK-8164971> fix we \
made changes to continue reading metadata until we reach IEND chunk. Before \
JDK-8164971 <https://bugs.openjdk.java.net/browse/JDK-8164971> change we used to stop \
reading metadata as soon as we hit first IDAT chunk. According to PNG spec there can \
be more than one IDAT chunk/ more headers after IDAT chunk. So we need to read \
metadata until we hit IEND chunk. But in case of this bug we have IEND chunk but it \
has corrupt/no CRC chunk, so we throw IIOException(According to PNG spec every PNG \
chunk should contain 4 byte CRC). But lot of other decoders accept these kind of \
images which has no CRC chunk for IEND chunk.   
 
Solution : There is no need to verify CRC for IEND chunk(Chunk data length for IEND \
is 0). Stop reading metadata once we hit Chunk type info for IEND chunk.  
Thanks,
Jay


[Attachment #3 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html; \
charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: \
space; line-break: after-white-space;" class=""><div style="margin: 0in 0in 0.0001pt; \
font-size: 11pt; font-family: Calibri, sans-serif;" class="">Hello All,<o:p \
class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; \
font-family: Calibri, sans-serif;" class=""><o:p class="">&nbsp;</o:p></div><div \
style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" \
class="">Please review the following fix in JDK12:<o:p class=""></o:p></div><div \
style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" \
class=""><o:p class="">&nbsp;</o:p></div><div style="margin: 0in 0in 0.0001pt; \
font-size: 11pt; font-family: Calibri, sans-serif;" class="">Bug :&nbsp;<font \
color="#954f72" class=""><a href="https://bugs.openjdk.java.net/browse/JDK-8211422" \
class="">https://bugs.openjdk.java.net/browse/JDK-8211422</a></font>&nbsp;<o:p \
class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; \
font-family: Calibri, sans-serif;" class=""><o:p class="">&nbsp;</o:p></div><div \
style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" \
class="">Webrev:&nbsp;<font color="#954f72" class=""><a \
href="http://cr.openjdk.java.net/~jdv/8211422/webrev.00/" \
class="">http://cr.openjdk.java.net/~jdv/8211422/webrev.00/</a></font>&nbsp;<o:p \
class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; \
font-family: Calibri, sans-serif;" class=""><o:p class="">&nbsp;</o:p></div><div \
style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" \
class="">Issue : When we try to read PNG image with corrupt/no 4 byte CRC data for \
IEND chunk we throw IIOException. We see this issue only after&nbsp;<o:p \
class=""></o:p><a class="issue-link" data-issue-key="JDK-8164971" \
href="https://bugs.openjdk.java.net/browse/JDK-8164971" id="key-val" rel="4898954" \
style="caret-color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; \
color: rgb(59, 115, 175); text-decoration: none; cursor: \
pointer;">JDK-8164971</a>.</div><div style="margin: 0in 0in 0.0001pt; font-size: \
11pt; font-family: Calibri, sans-serif;" class=""><o:p \
class="">&nbsp;</o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; \
font-family: Calibri, sans-serif;" class="">Root cause : In&nbsp;<o:p \
class=""></o:p><a class="issue-link" data-issue-key="JDK-8164971" \
href="https://bugs.openjdk.java.net/browse/JDK-8164971" id="key-val" rel="4898954" \
style="caret-color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; \
color: rgb(59, 115, 175); text-decoration: none; cursor: \
pointer;">JDK-8164971</a>&nbsp;fix we made changes to continue reading metadata until \
we reach IEND chunk. Before&nbsp;<a class="issue-link" data-issue-key="JDK-8164971" \
href="https://bugs.openjdk.java.net/browse/JDK-8164971" id="key-val" rel="4898954" \
style="caret-color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 14px; \
color: rgb(59, 115, 175); text-decoration: none; cursor: \
pointer;">JDK-8164971</a>&nbsp;change we used to stop reading metadata as soon as we \
hit first IDAT chunk. According to PNG spec there can be more than one IDAT chunk/ \
more headers after IDAT chunk. So we need to read metadata until we hit IEND chunk. \
But in case of this bug we have IEND chunk but it has corrupt/no CRC chunk, so we \
throw IIOException(According to PNG spec every PNG chunk should contain 4 byte CRC). \
But lot of other decoders accept these kind of images which has no CRC chunk for IEND \
chunk.&nbsp;</div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: \
Calibri, sans-serif;" class="">&nbsp;</div><div style="margin: 0in 0in 0.0001pt; \
font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p \
class="">&nbsp;</o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; \
font-family: Calibri, sans-serif;" class="">Solution : There is no need to verify CRC \
for IEND chunk(Chunk data length for IEND is 0). Stop reading metadata once we hit \
Chunk type info for IEND chunk.<o:p class=""></o:p></div><div style="margin: 0in 0in \
0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p \
class="">&nbsp;</o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; \
font-family: Calibri, sans-serif;" class="">Thanks,<o:p class=""></o:p></div><div \
style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" \
class="">Jay</div></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic