Skip to content

Commit 1a7b70a

Browse files
committed
8269091: javax/sound/sampled/Clip/SetPositionHang.java failed with ArrayIndexOutOfBoundsException: Array index out of range: -4
Reviewed-by: serb
1 parent 16f649b commit 1a7b70a

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
@@ -1297,8 +1297,9 @@ public void run() {
12971297
}
12981298
}
12991299
while (doIO && thread == curThread) {
1300-
if (newFramePosition >= 0) {
1301-
clipBytePosition = newFramePosition * frameSize;
1300+
int npf = newFramePosition; // copy into local variable
1301+
if (npf >= 0) {
1302+
clipBytePosition = npf * frameSize;
13021303
newFramePosition = -1;
13031304
}
13041305
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)