Skip to content

Commit

Permalink
c2acr: Fix segfaults for small fftsize
Browse files Browse the repository at this point in the history
  • Loading branch information
r9y9 committed Aug 8, 2017
1 parent 0d92551 commit 74bc912
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# News for pysptk

## v0.1.8

- c2acr: Fix segfaults for small fftsize

## v0.1.7

- Extend vec2vec functions to mat2mat [#49]
Expand Down
2 changes: 2 additions & 0 deletions pysptk/_sptk.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ def c2acr(np.ndarray[np.float64_t, ndim=1, mode="c"] c not None,
order=None,
fftlen=256):
assert_fftlen(fftlen)
if len(c) > fftlen:
raise ValueError("fftlen must be larger than length of input")
cdef np.ndarray[np.float64_t, ndim = 1, mode = "c"] r
cdef int src_order = len(c) - 1
if order is None:
Expand Down
3 changes: 3 additions & 0 deletions tests/test_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def __test_fftlen(fftlen):
for fftlen in [257, 513]:
yield raises(ValueError)(__test_fftlen), fftlen

def __test_small_fftsize():
yield raises(ValueError)(__test_fftlen), 16


def test_c2ir():
for order in [15, 20, 25, 30]:
Expand Down

0 comments on commit 74bc912

Please sign in to comment.