Mercurial > hg > release > icedtea-1.9
changeset 1627:2fc5fc367791
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.
(transplanted from 24c29e381e49af0a0c76d96d8f1db05a66fcbd38)
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Wed, 11 Feb 2009 09:14:17 -0500 |
parents | efecea0d299f |
children | 08edc623690b |
files | pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java |
diffstat | 1 files changed, 3 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java Mon Mar 02 21:55:35 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;