Hi all

 

In Saver.java.entitizeCommment() the last 2 lines read:

 

    if (_buf[ _lastEmitIn + _lastEmitCch - 1 ] == '-')
        i = replace( _lastEmitIn + _lastEmitCch - 1, " " );

 

but _buf is a circular buffer and it is possible for (_lastEmitIn + _lastEmitCch – 1) to be > the length of the _buf buffer. Instead the code should be:

 

    int offset = (_lastEmitIn + _lastEmitCch - 1) % _buf.length;

    if (_buf[ offset ] == '-')

        i = replace( offset, " " );

 

otherwise you can get an ArrayIndexOutOfBoundException.

 

I am attaching a patch which fixes this. I’d be grateful if one of the committers would check it in.

 

Thanks,

 

Lawrence Jones

 

Reply via email to