[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-2d-dev
Subject: Re: [OpenJDK 2D-Dev] RFR: 8149120: TIFFField constructor throws ArrayIndexOutOfBoundsException and I
From: Phil Race <philip.race () oracle ! com>
Date: 2016-02-10 19:50:54
Message-ID: 56BB949E.80809 () oracle ! com
[Download RAW message or body]
+1
-phil.
On 02/09/2016 11:35 AM, Brian Burkhalter wrote:
> Please review at your convenience.
>
> Issue:https://bugs.openjdk.java.net/browse/JDK-8149120
> Patch:see below
>
> Summary: Clean up parameter checking for
> TIFFField(TIFFTag,int,int,Object).
>
> Thanks,
>
> Brian
>
> ---
> a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java
> +++
> b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java
> @@ -519,6 +519,11 @@
> * @throws IllegalArgumentException if <code>type</code> is an
> unacceptable
> * data type for the supplied <code>TIFFTag</code>.
> * @throws IllegalArgumentException if
> <code>count < 0</code>.
> *+ * @throws IllegalArgumentException if
> <code>count < 1</code>*
> *+ * and <code>type</code> is <code>TIFF_RATIONAL</code> or*
> *+ * <code>TIFF_SRATIONAL</code>.*
> *+ * @throws IllegalArgumentException if
> <code>count ≠ 1</code>*
> *+ * and <code>type</code> is <code>TIFF_IFD_POINTER</code>.*
> * @throws NullPointerException if
> <code>data == null</code>.
> * @throws IllegalArgumentException if <code>data</code> is an
> instance of
> * a class incompatible with the specified type.
> @@ -534,6 +539,14 @@
> + " for " + tag.getName() + " tag");
> } else if(count < 0) {
> throw new IllegalArgumentException("count < 0!");
> *+ } else if((type == TIFFTag.TIFF_RATIONAL*
> *+ || type == TIFFTag.TIFF_SRATIONAL)*
> *+ && count < 1) {*
> *+ throw new IllegalArgumentException*
> *+ ("Type is TIFF_RATIONAL or TIFF_SRATIONAL and count < 1");*
> *+ } else if (type == TIFFTag.TIFF_IFD_POINTER && count != 1) {*
> *+ throw new IllegalArgumentException*
> *+ ("Type is TIFF_IFD_POINTER count != 1");*
> } else if(data == null) {
> throw new NullPointerException("data == null!");
> }
>
[Attachment #3 (text/html)]
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">+1<br>
<br>
-phil.<br>
<br>
On 02/09/2016 11:35 AM, Brian Burkhalter wrote:<br>
</div>
<blockquote
cite="mid:98A4B331-7BC1-442A-AD1B-2CFA1F38D8C3@oracle.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Please review at your convenience.
<div><br>
</div>
<div>Issue:<span class="Apple-tab-span" style="white-space:pre"> </span><a
moz-do-not-send="true"
href="https://bugs.openjdk.java.net/browse/JDK-8149120">https://bugs.openjdk.java.net/browse/JDK-8149120</a></div>
<div>Patch:<span class="Apple-tab-span" style="white-space:pre"> </span>see
below</div>
<div><br>
</div>
<div>Summary: Clean up parameter checking for
TIFFField(TIFFTag,int,int,Object).</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Brian</div>
<div><br>
</div>
<div>
<div style="margin: 0px;"><font face="Courier">---
a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java</font></div>
<div style="margin: 0px;"><font face="Courier">+++
b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java</font></div>
<div style="margin: 0px;"><font face="Courier">@@ -519,6 +519,11
@@</font></div>
<div style="margin: 0px;"><font face="Courier"> * @throws
IllegalArgumentException if <code>type</code> is
an unacceptable</font></div>
<div style="margin: 0px;"><font face="Courier"> * data \
type
for the supplied <code>TIFFTag</code>.</font></div>
<div style="margin: 0px;"><font face="Courier"> * @throws
IllegalArgumentException if
<code>count&nbsp;&lt;&nbsp;0</code>.</font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ *
@throws IllegalArgumentException if
<code>count&nbsp;&lt;&nbsp;1</code></b></font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ * and
<code>type</code> is
<code>TIFF_RATIONAL</code> or</b></font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ *
<code>TIFF_SRATIONAL</code>.</b></font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ *
@throws IllegalArgumentException if
<code>count&nbsp;&ne;&nbsp;1</code></b></font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ * and
<code>type</code> is
<code>TIFF_IFD_POINTER</code>.</b></font></div>
<div style="margin: 0px;"><font face="Courier"> * @throws
NullPointerException if
<code>data&nbsp;==&nbsp;null</code>.</font></div>
<div style="margin: 0px;"><font face="Courier"> * @throws
IllegalArgumentException if <code>data</code> is
an instance of</font></div>
<div style="margin: 0px;"><font face="Courier"> * a class
incompatible with the specified type.</font></div>
<div style="margin: 0px;"><font face="Courier">@@ -534,6 +539,14
@@</font></div>
<div style="margin: 0px;"><font face="Courier"> \
+ " for " + tag.getName() + " tag");</font></div>
<div style="margin: 0px;"><font face="Courier"> \
} else if(count < 0) {</font></div>
<div style="margin: 0px;"><font face="Courier"> \
throw new IllegalArgumentException("count < 0!");</font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ \
} else if((type == TIFFTag.TIFF_RATIONAL</b></font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ \
|| type == \
TIFFTag.TIFF_SRATIONAL)</b></font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ \
&& count < 1) \
{</b></font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ \
throw new IllegalArgumentException</b></font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ \
("Type is TIFF_RATIONAL or TIFF_SRATIONAL and count <
1");</b></font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ \
} else if (type == TIFFTag.TIFF_IFD_POINTER && count
!= 1) {</b></font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ \
throw new IllegalArgumentException</b></font></div>
<div style="margin: 0px;"><font face="Courier"><b>+ \
("Type is TIFF_IFD_POINTER count != 1");</b></font></div>
<div style="margin: 0px;"><font face="Courier"> \
} else if(data == null) {</font></div>
<div style="margin: 0px;"><font face="Courier"> \
throw new NullPointerException("data == null!");</font></div>
<div style="margin: 0px;"><font face="Courier"> \
}</font></div> </div>
<div><br>
</div>
</blockquote>
<br>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic