com.sun.media.sound.RIFFInvalidDataException: Chunk size too big

JDK Bug System | Webbug Group | 1 year ago
  1. 0

    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 ----------

    JDK Bug System | 1 year ago | Webbug Group
    com.sun.media.sound.RIFFInvalidDataException: Chunk size too big

    Root Cause Analysis

    1. com.sun.media.sound.RIFFInvalidDataException

      Chunk size too big

      at com.sun.media.sound.RIFFReader.<init>()
    2. Java RT
      AudioSystem.getAudioInputStream
      1. com.sun.media.sound.RIFFReader.<init>(RIFFReader.java:82)
      2. com.sun.media.sound.WaveFloatFileReader.internal_getAudioFileFormat(WaveFloatFileReader.java:65)
      3. com.sun.media.sound.WaveFloatFileReader.getAudioFileFormat(WaveFloatFileReader.java:55)
      4. com.sun.media.sound.WaveFloatFileReader.getAudioInputStream(WaveFloatFileReader.java:117)
      5. com.sun.media.sound.WaveFloatFileReader.getAudioInputStream(WaveFloatFileReader.java:164)
      6. javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1181)
      6 frames
    3. Unknown
      Sound.main
      1. Sound.main(Sound.java:7)
      1 frame