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

[macOS] DirectAudioDevice DirectDL.write fails with Array index out of range

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 11, 17
    • client-libs
    • None

      The jtreg test
      javax/sound/sampled/Clip/SetPositionHang.java triggers sometimes the following issue in DirectAudioDevice$DirectDL.write :

      java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -4
          at java.desktop/com.sun.media.sound.DirectAudioDevice$DirectDL.write(DirectAudioDevice.java:696)
          at java.desktop/com.sun.media.sound.DirectAudioDevice$DirectClip.run(DirectAudioDevice.java:1314)
          at java.base/java.lang.Thread.run(Thread.java:833)

      Looks like we call the write method sometimes with a negative offset value (clipBytePosition).
      Could potentially be an overflow , maybe we should check clipBytePosition for overflows, to have at least a better exception ?

      Issue was observed on
      darwin aarch64
      current jdk17u-dev
      macOS 11.6.1

            mbaesken Matthias Baesken
            mbaesken Matthias Baesken
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: