Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8132782

RIFFReader does not support WAVE-Files greater than 2 GiB

XMLWordPrintable

    • b114
    • x86_64
    • linux

      FULL PRODUCT VERSION :
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux 3.13.0-61-generic #100-Ubuntu SMP Wed Jul 29 11:21:34 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      Trying to read Wav-Files greater than 2 GiB results in a

      RIFFInvalidDataException("Chunk size too big")

      asking the AudioSystem to read it.

      This change introduced it:
      http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/ef65ddb32456

      But this exception just masks the underlying problem, that the readers behind are not able to read from such big streams. 1.7.0_80 does create the stream, but is unable to read from them.

      As a WAVE-File can be up to 4 GiB in size it should be possible to work with files greater than the current possible 2 GiB.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a 3 GiB wav file:

      dd if=/dev/zero of=silence.raw bs=1M count=3000
      sox -r 16k -e signed -b 8 -c 1 silence.raw silence.wav

      2. Compile the Sound.java

      javac Sound.java

      3. Run the Code.

      java Sound /tmp/silence.wav


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Creates an InputStream to work with the Wav-File, where i can read the complete stream.
      Note: Using 1.7.0_80 i can create the stream but reading always results in 0 bytes read.
      ACTUAL -
      java Sound /tmp/silence.wav
      Exception in thread "main" com.sun.media.sound.RIFFInvalidDataException: Chunk size too big
      at com.sun.media.sound.RIFFReader.<init>(RIFFReader.java:82)
      at com.sun.media.sound.WaveFloatFileReader.internal_getAudioFileFormat(WaveFloatFileReader.java:65)
      at com.sun.media.sound.WaveFloatFileReader.getAudioFileFormat(WaveFloatFileReader.java:55)
      at com.sun.media.sound.WaveFloatFileReader.getAudioInputStream(WaveFloatFileReader.java:117)
      at com.sun.media.sound.WaveFloatFileReader.getAudioInputStream(WaveFloatFileReader.java:164)
      at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1181)
      at Sound.main(Sound.java:7)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.File;
      import javax.sound.sampled.AudioSystem;

      public class Sound {
        
        public static void main(String[] args) throws Exception {
          AudioSystem.getAudioInputStream(new File(args[0]));
        }
      }

      ---------- END SOURCE ----------

            serb Sergey Bylokhov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: