dev@fi.java.net

Re: _octetBufferStart

From: Alan Hudson <giles_at_yumetech.com>
Date: Mon, 28 Feb 2005 11:21:08 -0800

Paul Sandoz wrote:

> Alan Hudson wrote:
>
>> Paul Sandoz wrote:
>>
>>> Alan Hudson wrote:
>>>
>>>> Seems I'm running off the end of the octetBuffer after some number
>>>> of encoding algo runs.
>>>>
>>>> I don't see any place that decrements _octetBufferStart. It also
>>>> seems like the ensureCapacity may not be called in enough places.
>>>> I'm pretty tired now so it will likely be Monday before I can dig
>>>> into why this one breaks.
>>>
>>>
>>>
>>>
>>> Not enough info to tell if this is a encoding or decoding issue.
>>>
>>> _octetBufferStart should never be decremented. It defines the
>>> starting index the octets of encoding algorithm data in the
>>> _octetBuffer.
>>>
if _octetBufferStart never decrements then the array must keep growing.

Calls like this are made to the decoders:
                decodeFromBytes(_octetBuffer, _octetBufferStart,
_octetBufferLength);

So if octeBufferStart never goes back to zero then octetBuffer must
always grow.

Should these calls be using _octetBufferOffset... that gets zeroed
during ensureOctetBufferSize().

>
> There could be something wrong with the Decoder.ensureOctetBufferSize
> method.
>
I don't see a way this buffer won't just keep growing over time. I'd
assume after an algorithm is done the _octetBufferStart would go back to
zero?