Skip to content

Commit 06772f1

Browse files
committed
8269091: javax/sound/sampled/Clip/SetPositionHang.java failed with ArrayIndexOutOfBoundsException: Array index out of range: -4
Backport-of: b6a5d2082832c9d70051df8d4a5190f6a6faec58
1 parent daeb362 commit 06772f1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,8 +1377,9 @@ public void run() {
13771377
}
13781378
}
13791379
while (doIO && thread == curThread) {
1380-
if (newFramePosition >= 0) {
1381-
clipBytePosition = newFramePosition * frameSize;
1380+
int npf = newFramePosition; // copy into local variable
1381+
if (npf >= 0) {
1382+
clipBytePosition = npf * frameSize;
13821383
newFramePosition = -1;
13831384
}
13841385
int endFrame = getFrameLength() - 1;

test/jdk/javax/sound/sampled/Clip/SetPositionHang.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
/**
3030
* @test
31-
* @bug 8266421
31+
* @bug 8266421 8269091
3232
* @summary Tests that Clip.setFramePosition/setMicrosecondPosition do not hang.
3333
*/
3434
public final class SetPositionHang implements Runnable {

0 commit comments

Comments
 (0)