natString.cc (init): Test for overflow condition during out of bounds check.
2000-01-09 Anthony Green <green@cygnus.com> * java/lang/natString.cc (init): Test for overflow condition during out of bounds check. (getChars): Throw StringIndexOutOfBoundsException, not ArrayIndexOutOfBoundsException. (getBytes): Ditto. (regionMatches): Obey case option during string comparison. * configure.host (ligcj_interpreter): New variable. Enable interpreter by default on IA-32. * configure.in: Examine libgcj_interpreter. * configure: Rebuilt. From-SVN: r31300
This commit is contained in:
parent
0e3dd56798
commit
b11f64301a
@ -1,3 +1,17 @@
|
||||
2000-01-09 Anthony Green <green@cygnus.com>
|
||||
|
||||
* java/lang/natString.cc (init): Test for overflow condition
|
||||
during out of bounds check.
|
||||
(getChars): Throw StringIndexOutOfBoundsException, not
|
||||
ArrayIndexOutOfBoundsException.
|
||||
(getBytes): Ditto.
|
||||
(regionMatches): Obey case option during string comparison.
|
||||
|
||||
* configure.host (ligcj_interpreter): New variable. Enable
|
||||
interpreter by default on IA-32.
|
||||
* configure.in: Examine libgcj_interpreter.
|
||||
* configure: Rebuilt.
|
||||
|
||||
2000-01-07 Tom Tromey <tromey@cygnus.com>
|
||||
|
||||
* mauve-libgcj: Don't disable ClassTest.
|
||||
|
311
libjava/configure
vendored
311
libjava/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -24,6 +24,7 @@ libgcj_cflags=
|
||||
libgcj_cxxflags=
|
||||
libgcj_javaflags=
|
||||
libgcj_sjlj=
|
||||
libgcj_interpreter=
|
||||
|
||||
case "${target_optspace}:${host}" in
|
||||
yes:*)
|
||||
@ -58,6 +59,7 @@ case "${host}" in
|
||||
;;
|
||||
i686-*|i586-*)
|
||||
libgcj_flags="${libgcj_flags} -ffloat-store"
|
||||
libgcj_interpreter=yes
|
||||
DIVIDESPEC=-fno-use-divide-subroutine
|
||||
;;
|
||||
sparc-*)
|
||||
|
@ -61,9 +61,14 @@ dnl See if the user has the interpreter included.
|
||||
AC_ARG_ENABLE(interpreter,
|
||||
[ --enable-interpreter enable interpreter],
|
||||
if test "$enable_interpreter" = yes; then
|
||||
AC_DEFINE(INTERPRETER)
|
||||
# This can also be set in configure.host.
|
||||
libgcj_interpreter=yes
|
||||
fi)
|
||||
|
||||
if test "$libgcj_interpreter" = yes; then
|
||||
AC_DEFINE(INTERPRETER)
|
||||
fi
|
||||
|
||||
EXCEPTIONSPEC=
|
||||
dnl See if we should use setjmp/longjmp exceptions
|
||||
AC_ARG_ENABLE(sjlj-exceptions,
|
||||
|
@ -328,7 +328,8 @@ java::lang::String::init(jcharArray chars, jint offset, jint count,
|
||||
if (! chars)
|
||||
JvThrow (new NullPointerException);
|
||||
jsize data_size = JvGetArrayLength (chars);
|
||||
if (offset < 0 || count < 0 || offset + count > data_size)
|
||||
if (offset < 0 || count < 0 || offset + count < 0
|
||||
|| offset + count > data_size)
|
||||
JvThrow (new StringIndexOutOfBoundsException());
|
||||
jcharArray array;
|
||||
jchar *pdst;
|
||||
@ -451,7 +452,7 @@ java::lang::String::getChars(jint srcBegin, jint srcEnd,
|
||||
jint dst_length = JvGetArrayLength (dst);
|
||||
if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > count
|
||||
|| dstBegin < 0 || dstBegin + (srcEnd-srcBegin) > dst_length)
|
||||
JvThrow (new java::lang::ArrayIndexOutOfBoundsException());
|
||||
JvThrow (new java::lang::StringIndexOutOfBoundsException());
|
||||
register jchar *dPtr = elements (dst) + dstBegin;
|
||||
register jchar *sPtr = JvGetStringChars (this) + srcBegin;
|
||||
register jint i = srcEnd-srcBegin;
|
||||
@ -501,7 +502,7 @@ java::lang::String::getBytes(jint srcBegin, jint srcEnd,
|
||||
jint dst_length = JvGetArrayLength (dst);
|
||||
if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > count
|
||||
|| dstBegin < 0 || dstBegin + (srcEnd-srcBegin) > dst_length)
|
||||
JvThrow (new java::lang::ArrayIndexOutOfBoundsException());
|
||||
JvThrow (new java::lang::StringIndexOutOfBoundsException());
|
||||
register jbyte *dPtr = elements (dst) + dstBegin;
|
||||
register jchar *sPtr = JvGetStringChars (this) + srcBegin;
|
||||
register jint i = srcEnd-srcBegin;
|
||||
@ -591,19 +592,25 @@ java::lang::String::regionMatches (jboolean ignoreCase, jint toffset,
|
||||
register jchar *tptr = JvGetStringChars (this) + toffset;
|
||||
register jchar *optr = JvGetStringChars (other) + ooffset;
|
||||
register jint i = len;
|
||||
while (--i >= 0)
|
||||
{
|
||||
jchar tch = *tptr++;
|
||||
jchar och = *optr++;
|
||||
if (tch != och)
|
||||
return false;
|
||||
if (ignoreCase
|
||||
&& (java::lang::Character::toLowerCase (tch)
|
||||
!= java::lang::Character::toLowerCase (och))
|
||||
&& (java::lang::Character::toUpperCase (tch)
|
||||
!= java::lang::Character::toUpperCase (och)))
|
||||
return false;
|
||||
}
|
||||
if (ignoreCase)
|
||||
while (--i >= 0)
|
||||
{
|
||||
jchar tch = *tptr++;
|
||||
jchar och = *optr++;
|
||||
if ((java::lang::Character::toLowerCase (tch)
|
||||
!= java::lang::Character::toLowerCase (och))
|
||||
&& (java::lang::Character::toUpperCase (tch)
|
||||
!= java::lang::Character::toUpperCase (och)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
while (--i >= 0)
|
||||
{
|
||||
jchar tch = *tptr++;
|
||||
jchar och = *optr++;
|
||||
if (tch != och)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user