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

David Cournapeau david at ar.media.kyoto-u.ac.jp
Wed Nov 14 22:48:46 EST 2007


Achim Gaedke wrote:
> Hello everybody!
>
> Please have a look at the program below:
>
> # start
> import numpy
>
> t_array=numpy.ones(2048, dtype=numpy.float32)
> sinc_array=numpy.array((len(t_array),),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
>   
Could you open a ticket on the numpy trac system ? (I can confirm the bug)

cheers,

David



More information about the NumPy-Discussion mailing list