[Numpy-discussion] SegFault/double free with simple array mask operation

Achim Gaedke Achim.Gaedke at physik.tu-darmstadt.de
Wed Nov 14 13:31:38 EST 2007

Hello everybody!

Please have a look at the program below:

# start
import numpy

t_array=numpy.ones(2048, dtype=numpy.float32)
sinc_array[(t_array > 0.)]=1.0
# end

If you execute this program, it crashes with Segmentation Fault or
*** glibc detected *** python: double free or corruption (out): 
0x081fe470 ***

It depends on the circumstances, which error occurs, e.g. you must quit 
your interpreter if you are in interactvie mode.

Obviously numpy.array() should be numpy.zeros() or numpy.empty() .... 
But this program should not crash with a core dump.

Used Linux Versions are:
Debian Testing with numpy 1.0.3,
Debian Stable with numpy 1.0.1,
Ubuntu Linux 6.10 with numpy 1.0
Also numpy-1.0.4 crashes.

Yours, Achim

More information about the NumPy-Discussion mailing list