8054431: Some of the input validation in the javasound is too strict
authorserb
Fri, 08 Aug 2014 21:40:46 +0400
changeset 26034 a5efd96d0482
parent 26033 3f7c9aad7cc0
child 26035 250f55e44bea
8054431: Some of the input validation in the javasound is too strict Reviewed-by: azvegint, alexsch
jdk/src/share/classes/com/sun/media/sound/RIFFReader.java
--- a/jdk/src/share/classes/com/sun/media/sound/RIFFReader.java	Fri Aug 08 16:19:36 2014 +0400
+++ b/jdk/src/share/classes/com/sun/media/sound/RIFFReader.java	Fri Aug 08 21:40:46 2014 +0400
@@ -74,14 +74,13 @@
         fourcc[0] = (byte) b;
         readFully(fourcc, 1, 3);
         this.fourcc = new String(fourcc, "ascii");
-        final long size = readUnsignedInt();
-        if (size > Integer.MAX_VALUE) {
-            throw new RIFFInvalidDataException("Chunk size too big");
-        }
-        ckSize = size;
-        avail = size;
+        ckSize = readUnsignedInt();
+        avail = ckSize;
 
         if (getFormat().equals("RIFF") || getFormat().equals("LIST")) {
+            if (avail > Integer.MAX_VALUE) {
+                throw new RIFFInvalidDataException("Chunk size too big");
+            }
             byte[] format = new byte[4];
             readFully(format);
             this.riff_type = new String(format, "ascii");