diff options
author | Tom Tromey <tromey@redhat.com> | 2001-05-24 18:06:03 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2001-05-24 18:06:03 +0000 |
commit | cb894e07ec764859e793baf8ff7487a83a3557cc (patch) | |
tree | dfc043812acf6767a2f41c962edeaddfbc0b6356 /libjava | |
parent | cf6b8de459f1da85529f8dabb38ef2d24a4e23ed (diff) | |
download | gcc-cb894e07ec764859e793baf8ff7487a83a3557cc.zip gcc-cb894e07ec764859e793baf8ff7487a83a3557cc.tar.gz gcc-cb894e07ec764859e793baf8ff7487a83a3557cc.tar.bz2 |
natString.cc (init): Throw ArrayIndexOutOfBoundsException.
* java/lang/natString.cc (init): Throw
ArrayIndexOutOfBoundsException.
(getChars): Likewise.
(getBytes): Likewise.
(valueOf): Likewise.
From-SVN: r42531
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 6 | ||||
-rw-r--r-- | libjava/java/lang/natString.cc | 18 |
2 files changed, 16 insertions, 8 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index cabec91..37d924a 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,11 @@ 2001-05-24 Tom Tromey <tromey@redhat.com> + * java/lang/natString.cc (init): Throw + ArrayIndexOutOfBoundsException. + (getChars): Likewise. + (getBytes): Likewise. + (valueOf): Likewise. + * configure.in: Only allow hash synchronization when POSIX threads are enabled. * java/lang/natObject.cc (alloc_heavy): Properly find `init' field diff --git a/libjava/java/lang/natString.cc b/libjava/java/lang/natString.cc index 5201882..82d5d0c 100644 --- a/libjava/java/lang/natString.cc +++ b/libjava/java/lang/natString.cc @@ -445,7 +445,7 @@ java::lang::String::init(jcharArray chars, jint offset, jint count, jsize data_size = JvGetArrayLength (chars); if (offset < 0 || count < 0 || offset + count < 0 || offset + count > data_size) - throw new StringIndexOutOfBoundsException; + throw new ArrayIndexOutOfBoundsException; jcharArray array; jchar *pdst; if (! dont_copy) @@ -475,7 +475,7 @@ java::lang::String::init(jbyteArray ascii, jint hibyte, jint offset, jsize data_size = JvGetArrayLength (ascii); if (offset < 0 || count < 0 || offset + count < 0 || offset + count > data_size) - throw new java::lang::StringIndexOutOfBoundsException; + throw new ArrayIndexOutOfBoundsException; jcharArray array = JvNewCharArray(count); jbyte *psrc = elements (ascii) + offset; jchar *pdst = elements (array); @@ -498,7 +498,7 @@ java::lang::String::init (jbyteArray bytes, jint offset, jint count, jsize data_size = JvGetArrayLength (bytes); if (offset < 0 || count < 0 || offset + count < 0 || offset + count > data_size) - throw new StringIndexOutOfBoundsException; + throw new ArrayIndexOutOfBoundsException; jcharArray array = JvNewCharArray (count); gnu::gcj::convert::BytesToUnicode *converter = gnu::gcj::convert::BytesToUnicode::getDecoder(encoding); @@ -565,9 +565,10 @@ java::lang::String::getChars(jint srcBegin, jint srcEnd, jcharArray dst, jint dstBegin) { jint dst_length = JvGetArrayLength (dst); - if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > count - || dstBegin < 0 || dstBegin + (srcEnd-srcBegin) > dst_length) + if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > count) throw new java::lang::StringIndexOutOfBoundsException; + if (dstBegin < 0 || dstBegin + (srcEnd-srcBegin) > dst_length) + throw new ArrayIndexOutOfBoundsException; jchar *dPtr = elements (dst) + dstBegin; jchar *sPtr = JvGetStringChars (this) + srcBegin; jint i = srcEnd-srcBegin; @@ -615,9 +616,10 @@ java::lang::String::getBytes(jint srcBegin, jint srcEnd, jbyteArray dst, jint dstBegin) { jint dst_length = JvGetArrayLength (dst); - if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > count - || dstBegin < 0 || dstBegin + (srcEnd-srcBegin) > dst_length) + if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > count) throw new java::lang::StringIndexOutOfBoundsException; + if (dstBegin < 0 || dstBegin + (srcEnd-srcBegin) > dst_length) + throw new ArrayIndexOutOfBoundsException; jbyte *dPtr = elements (dst) + dstBegin; jchar *sPtr = JvGetStringChars (this) + srcBegin; jint i = srcEnd-srcBegin; @@ -1007,7 +1009,7 @@ java::lang::String::valueOf(jcharArray data, jint offset, jint count) { jint data_length = JvGetArrayLength (data); if (offset < 0 || count < 0 || offset+count > data_length) - throw new java::lang::IndexOutOfBoundsException; + throw new ArrayIndexOutOfBoundsException; jstring result = JvAllocString(count); jchar *sPtr = elements (data) + offset; jchar *dPtr = JvGetStringChars(result); |