Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > by-pkgid > 5d9f96a61df66f474656cde507a94c17 > files > 16

java-1.6.0-openjdk-1.6.0.0-0.19.b14.3mdv2009.1.src.rpm

--- oldPulseAudioSourceDataLine.java	2009-03-31 11:47:13.000000000 -0400
+++ pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	2009-03-31 11:51:19.000000000 -0400
@@ -151,19 +151,15 @@
 			throw new IllegalArgumentException(
 					"amount of data to write does not represent an integral number of frames");
 		}
+		
 		if (length < 0) {
-			throw new IllegalArgumentException("length is negative");
+		    throw new IllegalArgumentException("length is negative");
 		}
-
-		if (offset < 0) {
-			throw new ArrayIndexOutOfBoundsException("offset is negative: "
-					+ offset);
-		}
-
-		if (length + offset > data.length) {
+		
+		if (length < 0 || offset < 0 || offset > data.length - length) {
 			throw new ArrayIndexOutOfBoundsException(
-					"writing data beyond the length of the array: "
-							+ (length + offset));
+					"Overflow condition: buffer.length=" + data.length + 
+							" offset= " + offset + " length=" + length );
 		}
 
 		int position = offset;
--- oldPulseAudioTargetDataLine.java	2009-03-31 11:47:19.000000000 -0400
+++ pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java	2009-03-31 11:47:32.000000000 -0400
@@ -156,10 +156,10 @@
 		if (length < 0) {
 			throw new IllegalArgumentException("length is negative");
 		}
-
-		if (length + offset > data.length) {
-			throw new ArrayIndexOutOfBoundsException("index: "
-					+ (length + offset) + " array size: " + data.length);
+		
+		if ( offset < 0 || offset > data.length - length) {
+			throw new ArrayIndexOutOfBoundsException("array size: " + data.length
+					+ " offset:" + offset + " length:" + length );
 		}
 
 		/* everything ok */