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

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P3
    • None
    • Affects Version/s: 11, 17
    • Component/s: 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

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

              Created:
              Updated:
              Resolved: