This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [fwd] Patch for tow JNI Bugs (from: martin.kahlert@infineon.com)
- To: martin dot kahlert at infineon dot com
- Subject: Re: [fwd] Patch for tow JNI Bugs (from: martin.kahlert@infineon.com)
- From: Tom Tromey <tromey at redhat dot com>
- Date: 27 Apr 2001 09:53:48 -0600
- Cc: java-patches at gcc dot gnu dot org
- References: <20010427082633.A29513@keksy.muc.infineon.com>
- Reply-To: tromey at redhat dot com
>>>>> "Martin" == Martin Kahlert <martin.kahlert@infineon.com> writes:
Martin> Alexandre told me, that java-patches would be the best list
Martin> for that. So here it goes:
Thanks. I still have your original post but hadn't gotten to looking
at it yet.
FYI:
* Please send a properly-formatted ChangeLog entry with each patch
* Please either use `cvs diff' or use `diff OLD NEW' -- your patch
was reversed
Martin> There were problems with wrong types in functions
Martin> [G,S]et*ArrayRegion.
Thanks for catching this! I'm checking in this part of your patch.
Martin> The other change in jni.cc addresses an off by one error
Martin> in [GS]etPrimitiveArrayRegion:
Martin> The condition start + len >= array->length is always valid
Martin> if you copy a complete array (start=0, len = array->length).
Martin> This is wrong.
I agree that the test is wrong, however...
Martin> ! jsize end = start + len; // may be smaller than start (due to overflow or len < 0)
Martin> !
Martin> ! if (end < start || len > array->length)
I don't think this is right.
Suppose start = 1, len = 2, and array->length = 2
Then your test would say that this is ok.
But really this is not ok.
I think the right test is:
if (start < 0 || len < 0
|| (unsigned) (start + len) > (unsigned) array->length)
Tom