[ZODB-Dev] Integer Overflow on new pack impl

Tim Peters tim at zope.com
Mon May 19 20:55:27 EDT 2003


[Sidnei da Silva]
> I just got an IntegerOverflow while trying to pack a not-so-big ZODB
> (3.5Gb) with the new fspack implementation. The error occurred on line
> 459 of ZODB/fspack.py of Zope-2_6-branch, inside the buildPackIndex
> method.

Oops.  Anything over 2GB overflows a signed 32-bit int, so that makes sense.

> I changed the initialization of 'pos' a few lines above from '4' to
> '4L', and I hope that it will do the trick (it takes a few minutes to
> pack). I couldnt spot other places where this error can happen.

Thanks for the diagnosis!  That should do the trick.  By way of explanation
(although not excuse), the new pack code was backported from ZODB4, which
requires Python 2.2 or later.  When an integer operation overflows a
(Python) short int in 2.2, it automatically produces the correct Python
long-int result -- integer overflow just doesn't happen anymore, so none of
the largefile tests we ran under ZODB4 could have provoked this bug.  Alas,
I don't believe we have any giant-file pack tests that run as part of the
std test suite, and that left a hole that we tripped over here.




More information about the ZODB-Dev mailing list