[OpenJDK 2D-Dev] RFR: 8149120: TIFFField constructor throws ArrayIndexOutOfBoundsException and IllegalArgumentException for scenarios explained in description
Phil Race
philip.race at oracle.com
Wed Feb 10 19:50:54 UTC 2016
+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!");
> }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20160210/adce50d5/attachment.html>
More information about the 2d-dev
mailing list