[Patch] natString.cc: Some fixes for bounds checking arithmetic.

Bryce McKinlay bryce@mckinlay.net.nz
Tue Sep 23 14:03:00 GMT 2003


On Tuesday, Sep 23, 2003, at 18:43 Pacific/Auckland, Ralph Loader wrote:

> libgcj contains many places where checking of array index arguments
> passed to methods is done incorrectly.
>
> The attached patch fixes those in natString.cc that it is not difficult
> to write test cases for.

Wow, good catch. Do you have GCC and/or Classpath FSF assignment papers 
on file? We can accept simple patches without assignment however if 
you're likely to make further contributions then its best to get this 
out of the way.  See http://gcc.gnu.org/contribute.html for more 
information.

> There are many other instances of incorrect bounds checking that would
> require a 64 bit machine with gigabytes of memory (which I don't have),
> in order to write proper test cases.

> Alternatively, I could fix those without test cases.  Would that be
> acceptable?

If you need a 4 GB string to break it, then I'd be inclined to ignore 
it as an extremely pessimistic case! However, it doesn't hurt to be 
correct and if the changes don't add significant overhead or complexity 
then they should be fine. Its up to you.

Regards

Bryce.



More information about the Java-patches mailing list