Mutable Strings - Any libraries that offer this?

Neil Hodgson nyamatongwe+thunder at gmail.com
Sun Jul 26 20:25:46 EDT 2009


Mark Lawrence:

> If my sleuthing is correct the problem is with these lines
> 
> ilow *= self->itemSize;
> ihigh *= self->itemSize;
> 
> in GapBuffer_slice being computed before ilow and ihigh are compared to
> anything.

   This particular bug was because ihigh is the maximum 32 bit integer
2147483647 so multiplying it by the integer item size (4) caused
overflow. Adding an extra check fixes this:
    if (ihigh > self->lengthBody / self->itemSize)
        ihigh = self->lengthBody / self->itemSize;

   Committed a new version 1.02 and new downloads are available from
Google code.
http://code.google.com/p/gapbuffer/downloads/list

   Neil



More information about the Python-list mailing list