[Patch] StringBuffer.java index checking.

Ralph Loader suckfish@ihug.co.nz
Tue Sep 23 21:03:00 GMT 2003


This fixes 4 cases of index checking in StringBuffer, with test cases.

Passes make check in libjava.

In each case, the comments indicate that StringIndexOutOfBoundsException
should be thrown.  Without the fixes, ArrayIndexOutOfBoundsException can
be thrown.

Again, there are more cases where integer overflow might happen, but you
probably need large amounts of memory to trigger them.

2003-09-24  Ralph Loader  <suckfish@ihug.co.nz>

	* java/lang/StringBuffer.java (getChars): Fix array index checks.
	(append, substring, insert): Likewide.
	* testsuite/libjava.lang/StringBuffer_overflow.java: New file.
	* testsuite/libjava.lang/StringBuffer_overflow.out: New file.

Ralph.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: stringbuf.diff
Type: text/x-patch
Size: 4813 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20030923/2ddba51f/attachment.bin>


More information about the Java-patches mailing list