[fwd] Patch for tow JNI Bugs (from: martin.kahlert@infineon.com)
Tom Tromey
tromey@redhat.com
Fri Apr 27 08:44:00 GMT 2001
>>>>> "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
More information about the Java-patches
mailing list