Commit Graph
40 Commits
Author SHA1 Message Date
Davide FacontiandClaude Opus 5.5 24fa326186 kiss_fft: validate sizes in the alloc functions and next_fast_size
- kiss_fft_alloc(0) passed the overflow check and computed
  sizeof(kiss_fft_cpx)*(nfft-1) with nfft-1 == -1, returning a config.
  Reject nfft <= 0 (negative sizes were only rejected by accident of the
  signed/unsigned comparison, which is now an explicit cast).
- kiss_fftr_alloc(0) halved 0 and built a config around a NULL
  sub-state. Reject nfft <= 0 along with odd sizes, and compute
  nfft*3/2 in size_t.
- kiss_fftnd_alloc multiplied the dimensions in an int, so {65536,65536}
  wrapped to 0 and {46342,46342} to a negative value: the size query
  reported a bogus size and a far too small buffer was accepted. Reject
  dims <= 0 and products that do not fit in an int (st->dimprod) or whose
  buffer size overflows size_t, reporting *lenmem = (size_t)-1 as
  kiss_fftndr_alloc does.
- kiss_fft_next_fast_size incremented n past INT_MAX for
  n > 2125764000 (the largest 2,3,5-smooth int) and returned a negative
  value. It now returns n itself there (documented in kiss_fft.h): no
  2,3,5-smooth int >= n exists, and n is still a valid, if slower, size
  for callers that pass the result straight to an alloc.
- kfc.c read an uninitialized length when the size query rejected nfft;
  it now returns NULL for an invalid size.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01ME1hnNaoD3ZcMj9H8TSYkZ
2026-11-11 10:12:39 +01:00
AC d3a85a9e01 docs: explain forward and inverse normalization 2026-10-19 11:51:48 +08:00
yuanhecai eeb2e98ff6 loongarch: add lasx simd opt 2025-09-01 18:07:43 +08:00
yuanhecai c94458d8f2 loongarch: add lsx simd opt 2025-09-01 18:07:39 +08:00
Anonymous Maarten 5c708d85db Add cmake install + MSVC dll support 2020-10-29 22:01:56 +01:00
Mark Borgerding e53d6d4bea changed tabs to spaces for consistency and fix compiler warnings. Removed assert call (would require assert.h inclusion somewhere). 2020-04-19 10:02:45 -04:00
Ben Supnik 58cf0c0fc1 alignment fixing for USE_SIMD - all memory allocations are rounded
up to 16-byte boundaries.  This fixes crashes where the sub-buffers
for complex FFTs end up unaligned violating compiler expectations
2020-04-18 20:43:26 -04:00
Brendan McDonnell d06e7a7106 Allow user override of KISS_FFT_MALLOC and/or KISS_FFT_FREE on SIMD platforms 2019-08-07 12:10:01 -04:00
Brendan McDonnell 033f759ee3 Allow user override of KISS_FFT_MALLOC and/or KISS_FFT_FREE on non-SIMD platforms 2019-08-07 12:07:02 -04:00
Brendan McDonnell 24d23ffbb8 whitespace 2019-08-07 12:04:31 -04:00
Jason Heeris d1f9113c51 Include stdint.h only where fixed point types are used. Use min/max values from stdint.h. 2019-04-05 19:27:40 +11:00
h.udo f73b91d570 [BSD-3-Clause] Add missing copyright notice 2018-07-19 14:49:00 +01:00
Stewart Hildebrand 8921e1a3b6 Use _mm_free on memory allocated with _mm_malloc.
kiss_fft_alloc and kiss_fftr_alloc internally use KISS_FFT_MALLOC to allocate memory, which is defined to _mm_malloc in a SIMD enabled application. Calling free() on memory allocated with _mm_malloc will result in unpredictable behavior. The configuration data allocated with _mm_malloc should be freed with a corresponding _mm_free.
2018-06-03 14:29:12 -04:00
Mark Borgerding 1300338c62 malloc declaration included with stdlib.h -- no need for malloc.h include (this can cause failure on mac) 2010-05-31 21:56:13 -04:00
Mark Borgerding 57925fd126 made threadsafe 2010-05-27 22:54:01 -04:00
Mark Borgerding 26f8faa6e8 changed code from memalign to _mm_malloc 2009-09-28 15:55:19 +00:00
Mark Borgerding 262fe2297b next fast size for real FFTs 2008-08-22 14:05:40 +00:00
Mark Borgerding fafecb8e5e changed memory.h to string.h 2007-01-07 20:29:34 +00:00
Mark Borgerding 2cce2ea306 added kiss_fft_next_fast_size() to determine the next number divisible by the radices 2,3,5 2006-06-28 03:25:02 +00:00
Mark Borgerding 18d0ad1604 *** empty log message *** 2005-10-07 12:29:36 +00:00
Mark Borgerding 3b5dfee961 added kiss_fft_cleanup
updated Makefiles for long and simd targets
2005-07-09 03:42:07 +00:00
Mark Borgerding 4be23bffa4 polishing SIMD changes 2005-06-25 04:38:19 +00:00
Mark Borgerding 7f6cbeab2e added simd capability 2005-06-24 03:03:31 +00:00
Mark Borgerding ed1a5f0cfc made easy to use longs for fixed point 2005-05-11 02:36:33 +00:00
Mark Borgerding 84b1a09015 *** empty log message *** 2004-04-27 02:19:41 +00:00
Mark Borgerding e3fe1598f0 bunch of minor code cleanup 2004-02-27 03:45:12 +00:00
Mark Borgerding dda6f9638e replaced void pointers with pointers to forward declared structs 2004-02-24 01:29:25 +00:00
Mark Borgerding 9ddb2bb744 *** empty log message *** 2004-01-30 03:40:54 +00:00
Mark Borgerding 4552a14801 added stride to fft input -- should simplify multi-dimensional FFTs 2003-12-29 18:50:13 +00:00
Mark Borgerding 6b23ebb5c1 getting ready for v100 2003-12-15 03:23:46 +00:00
Mark Borgerding 559c14b49b changed alloc functions to allow for initialization of user-supplied buffer 2003-12-14 03:02:30 +00:00
Mark Borgerding ef7f8ff6c0 getting ready to release version 1.0 2003-12-11 01:54:42 +00:00
Mark Borgerding b737756abb real fwd and rev fft works 2003-12-09 04:10:50 +00:00
Mark Borgerding f3c4a9e9ca internal checkpoint
split kiss_fft.c into multiple files.  It seems the best approach, all things considered.
2003-12-04 02:38:50 +00:00
Mark Borgerding cb5312efdc 2d fft seems to work 2003-11-06 03:59:31 +00:00
Mark Borgerding 1db3d91ee5 getting ready for next release 2003-10-26 04:07:32 +00:00
Mark Borgerding bca7fd5151 compiles with -ansi -pedantic 2003-10-18 01:23:34 +00:00
Mark Borgerding a962dc2681 took utility/test code out of main source file and moved down to sample_code 2003-08-10 15:39:15 +00:00
Mark Borgerding ccbc48dc63 additional features for peak picking 2003-08-09 01:03:04 +00:00
Mark Borgerding fa03256dc2 Initial revision 2003-08-09 00:59:17 +00:00