fl.peaks~ and 1-ary vector crash

Summary: fl.peaks~ crashes with 1-ary vectors

FrameLib Version: d12b329

Environment Details (Max/SC/Whatever): Max 7, OS 10.12

Steps to reproduce (Provide patch/code if possible):


Actual Result:

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000000010e744000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]
0   AHarker.fl-peaks-             	0x0000000119c467ad FrameLib_Peaks::process() + 237
1   AHarker.fl-once-              	0x0000000119ccc958 FrameLib_ProcessingQueue::add(FrameLib_DSP*) + 2776
2   AHarker.fl-once-              	0x0000000119ccd20e FrameLib_DSP::blockUpdate(double const* const*, double**, unsigned long) + 350
3   AHarker.fl-once-              	0x0000000119cc2c5c FrameLib_Expand<FrameLib_Once>::blockUpdate(double const* const*, double**, unsigned long) + 1116

Expected Result:

An error message? Not a punishment crash, at any rate


This is not a punishment crash - it is a coding error.

The problem is that I really like unsigned ints for values that shouldn’t be negative, but I forget that you have to be careful when subtracting them:

for (unsigned long i = 2; i < (sizeIn - 2); i++)

If I were cleverer I would have noticed that this line is not safe, given that I clearly thought about trying to prevent issues with low length inputs when coding.

Now fixed on master.

fl.peaks~ is still crashing for me, with OP’s patch as well as the help file. FL v1.0.1, Max 8 64bit, Windows 10.

Thanks Jesse - my current build isn’t crashing and given the helpfile was made with later builds I suspect they didn’t crash either on Mac. The line I quote above doesn’t even exist as far as I can see in the latest code - so I think this is a different issue, rather than the original one recurring.

Can you make an issue on GitHub if you have a moment/are able to? Issues · AlexHarker/FrameLib · GitHub

That will make it easier to track and I’ll find some time to boot up windows and figure out what badness is occurring here (which I suspect will be windows only).