[Numpy-discussion] advanced indexing bug with huge arrays?

Sturla Molden sturla at molden.no
Tue Jan 24 00:32:14 EST 2012


Den 24.01.2012 06:00, skrev Sturla Molden:
> Both i and length could overflow here. It should overflow on 
> allocation of more than 2 GB. There is also a lot of C longs in the 
> internal state (line 55-105), as well as the other functions.

The use of C long affects all the C and Pyrex source code in mtrand 
module, not just mtrand.pyx. All of it is fubar on Win64.

 From the C standard, a C long is only quarranteed to be "at least 32 
bits wide".  Thus a C long can only be expected to index up to 2**31 - 
1, and it is not a Windows specific problem.

So it seems there are hundreds of places in the mtrand module where 
integers can overflow on 64-bit Python.

Also the crappy old Pyrex code should be updated to some more recent Cython.

Sturla



More information about the NumPy-Discussion mailing list