changeset 1633:24c29e381e49

2009-02-11 Marc Schoenefeld <mschoene@redhat.com> Omair Majid <omajid@redhat.com> * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java (write): Fix bounds checking.
author Omair Majid <omajid@redhat.com>
date Wed, 11 Feb 2009 09:14:17 -0500
parents 5d4d8012aa03
children 551c49cb2e2a
files ChangeLog pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
diffstat 2 files changed, 9 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 11 02:18:27 2009 +0000
+++ b/ChangeLog	Wed Feb 11 09:14:17 2009 -0500
@@ -1,3 +1,9 @@
+2009-02-11  Marc Schoenefeld <mschoene@redhat.com>
+            Omair Majid  <omajid@redhat.com>
+
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
+	(write): Fix bounds checking.
+
 2009-02-11  Andrew John Hughes  <ahughes@redhat.com>
 
 	* Makefile.am:
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Wed Feb 11 02:18:27 2009 +0000
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Wed Feb 11 09:14:17 2009 -0500
@@ -151,19 +151,10 @@
 			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");
-		}
-
-		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;