From 909cf4e491116930f6385e48165c6e770cf8505d Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 6 Sep 2008 09:48:41 +0000 Subject: range-check fix: "array[0..0] of TType" changed to "array[0 .. (MaxInt div SizeOf(TType))-1] of TType" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1347 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/lib/fft/UFFT.pas | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/fft/UFFT.pas b/src/lib/fft/UFFT.pas index 87c981e0..6b094c98 100644 --- a/src/lib/fft/UFFT.pas +++ b/src/lib/fft/UFFT.pas @@ -52,7 +52,7 @@ unit UFFT; interface type - TSingleArray = array[0..0] of Single; + TSingleArray = array[0 .. (MaxInt div SizeOf(Single))-1] of Single; PSingleArray = ^TSingleArray; TFFTWindowFunc = ( @@ -142,9 +142,11 @@ implementation uses SysUtils; -type TIntArray = array[0..0] of Integer; -type TIntIntArray = array[0..0] of ^TIntArray; -var gFFTBitTable: ^TIntIntArray; +type TIntArray = array[0 .. (MaxInt div SizeOf(Integer))-1] of Integer; +type PIntArray = ^TIntArray; +type TIntIntArray = array[0 .. (MaxInt div SizeOf(PIntArray))-1] of PIntArray; +type PIntIntArray = ^TIntIntArray; +var gFFTBitTable: PIntIntArray; const MaxFastBits: Integer = 16; function IsPowerOfTwo(x: Integer): Boolean; @@ -197,9 +199,9 @@ begin len := 2; for b := 1 to MaxFastBits do begin - GetMem(gFFTBitTable^[b - 1], len * sizeof(Single)); + GetMem(gFFTBitTable[b - 1], len * sizeof(Single)); for i := 0 to len-1 do - gFFTBitTable^[b - 1][i] := ReverseBits(i, b); + gFFTBitTable[b - 1][i] := ReverseBits(i, b); len := len shl 1; end; end; -- cgit v1.2.3