EVALUATION
This regression affects:
6u29, 5.0u32, and 1.4.2_35.
Will need sustaining to determine appropriate release vehicles.
It does *NOT* affect 7u1, as the AppOutputStream.write() call returns
immediately if len==0.
|
EVALUATION
This was caused by 7064341.
It's legal to call:
AppOutputStream.write(b, 0, 0) // b is empty array (byte b [0])
We will drive the machinery of the handshake, but will not actually write any data into the OutputRecord r.
However, when you do this on the first record of the payload, you go through this code:
if (isFirstRecordOfThePayload && c.needToSplitPayload()) {
howmuch = Math.min(0x01, r.availableDataBytes());
which sets howmuch to 1. Then later:
if (howmuch > 0) {
r.write(b, 0, 1);
rightly throws an java.lang.IndexOutOfBoundsException since b is empty (zero byte array).
You need to set howmuch to 0 if len == 0,
otherwise min(0x1, r.availableDataBytes);
|