changeset 10216:1399b26cbd46

8054431: Some of the input validation in the javasound is too strict Reviewed-by: azvegint, alexsch
author serb
date Fri, 08 Aug 2014 21:40:46 +0400
parents 03c6d10108a4
children 3a42e7b82241
files src/share/classes/com/sun/media/sound/RIFFReader.java
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/media/sound/RIFFReader.java	Thu Aug 07 17:02:48 2014 +0400
+++ b/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");