Name: gm110360 Date: 08/05/2003
FULL PRODUCT VERSION :
1.4.0-beta2 on Tru64, but it's a SOURCE CODE problem
FULL OPERATING SYSTEM VERSION : Source code
A DESCRIPTION OF THE PROBLEM :
In InputStream.read, there's a comparison for array bounds:
else if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
It's sufficient to just test for:
off < 0 || len < 0 || (off + len) > b.length
If off > b.length, and len >= 0, then (off + len) must be >
b.length.
If (off + len) < 0, then one of off or len must be < 0.
One other little detail, the JavaDoc for that method
doesn't mention the ArrayIndexOutOfBoundsException.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Check the code
2.
3.
EXPECTED VERSUS ACTUAL BEHAVIOR :
I found this in 1.3 and 1.4.
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER WORKAROUND :
The only impact if a couple of cycles on each call to read
().
(Incident Review ID: 165243)
======================================================================