This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Incorrect array checks in jni.cc
- To: java-patches at gcc dot gnu dot org
- Subject: Incorrect array checks in jni.cc
- From: Martin Kahlert <martin dot kahlert at infineon dot com>
- Date: Thu, 3 May 2001 15:16:40 +0200
- Reply-To: martin dot kahlert at infineon dot com
Hi!
This time it should be the real fix :-)
(Reason: copy complete array --> start = 0, len = array->length.
We can copy up to array->length elements, the first is the 0.th,
the last one has index array->length-1)
This version works with my prog, the old one throws an exception.
(o.k. that's no evidence ;-))
I hope, that this time i provided a correct patch format.
Changelog:
2001-05-03 Martin Kahlert <martin.kahlert@infineon.com>
* jni.cc (_Jv_JNI_GetPrimitiveArrayRegion): Fixed bounds
checking.
(_Jv_JNI_SetPrimitiveArrayRegion): Likewise.
The patch:
*** jni.cc.old Thu May 3 14:56:41 2001
--- jni.cc Thu May 3 14:56:58 2001
***************
*** 1366,1372 ****
{
// The cast to unsigned lets us save a comparison.
if (start < 0 || len < 0
! || (unsigned long) (start + len) >= (unsigned long) array->length)
{
try
{
--- 1366,1372 ----
{
// The cast to unsigned lets us save a comparison.
if (start < 0 || len < 0
! || (unsigned long) (start + len) > (unsigned long) array->length)
{
try
{
***************
*** 1393,1399 ****
{
// The cast to unsigned lets us save a comparison.
if (start < 0 || len < 0
! || (unsigned long) (start + len) >= (unsigned long) array->length)
{
try
{
--- 1393,1399 ----
{
// The cast to unsigned lets us save a comparison.
if (start < 0 || len < 0
! || (unsigned long) (start + len) > (unsigned long) array->length)
{
try
{
--
The early bird gets the worm. If you want something else for
breakfast, get up later.