From e7f9023e55565c09cdc1f46200d0c1b2de18c84f Mon Sep 17 00:00:00 2001 From: serb Date: Fri, 8 Aug 2014 21:40:46 +0400 Subject: [PATCH] 8054431: Some of the input validation in the javasound is too strict Reviewed-by: azvegint, alexsch --- src/share/classes/com/sun/media/sound/RIFFReader.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/share/classes/com/sun/media/sound/RIFFReader.java b/src/share/classes/com/sun/media/sound/RIFFReader.java index 4855bf4e7..c30773831 100644 --- a/src/share/classes/com/sun/media/sound/RIFFReader.java +++ b/src/share/classes/com/sun/media/sound/RIFFReader.java @@ -74,14 +74,13 @@ public final class RIFFReader extends InputStream { 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"); -- GitLab