FFT crashes when given a list of non-complex numbers

Issue #39 resolved
Oscar Benjamin created an issue

I'm getting a crash with fft([1] * 100) or fft([1.0] * 100) but not fft([1j] * 100).

Example:

$ pypy
Python 2.7.9 (295ee98b6928, May 31 2015, 07:29:04)
[PyPy 2.6.0 with GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> from numpy.fft import fft
>>>> fft([1] * 100)
*** glibc detected *** pypy: malloc(): memory corruption: 0x000000000389da80 ***

At this point pypy has to be killed. It's not using any CPU but completely unresponsive.

Changing it to fft([1] * 4) I get a core dump (but it's really long so I've attached it).

Comments (3)

  1. mattip

    progress, the cffi-fft branch now properly converts input to complex128 / float64, like upstream. Note that the fft code exposed a bug with pypy2.6.1 and previous: astype for non-contiguous ndarrays produced incorrect strides (fixed on nightly).

    Now I get incorrect results, this works on upstream but not on pypy:

    a = np.zeros([2,2])
    a[0,0] = 2 * 2
    b = np.fft.irfftn(a)
    assert (b == 1).all(), b
    
  2. Log in to comment