jeremysalwen / kn0ck0ut-LV2

Port of kn0ck0ut to LV2 plugin
http://www.freewebs.com/st3pan0va/
GNU General Public License v3.0
40 stars 5 forks source link

kn0ck0ut crashes when accessing the latency values #2

Closed lllucius closed 10 years ago

lllucius commented 10 years ago

I've built it myself and have tried the Fedore 20 version and both crash. It happens when on line 212 in kn0ck0out.cpp:

*p(p_latency)=gfftSize;

Don't know why really. Even if you simply try to print the value with something like:

printf("latency = %f\n", *p(p_latency));

It still crashes.

The generated peg file seems to be "okay", but I don't know LV2 plugins so take that with a grain of salt. Here's the peg file:

ifndef kn_ck_ut_peg

define kn_ck_ut_peg

ifndef PEG_STRUCT

define PEG_STRUCT

typedef struct { float min; float max; float default_value; char toggled; char integer; char logarithmic; } peg_data_t;

endif

/* urn:St3pan0va.plugins.kn0ck0ut.1.1 */

static const char p_uri[] = "urn:St3pan0va.plugins.kn0ck0ut.1.1";

enum p_port_enum { p_left, p_right, p_outl, p_outr, p_mode, p_lowcut, p_highcut, p_decay, p_blur, p_windowsize, p_overlapf, p_phase, p_latency, p_n_ports };

static const peg_data_t p_ports[] = { { -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 }, { -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 }, { -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 }, { -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 }, { -3.40282e+38, 3.40282e+38, 0, 0, 0, 0 }, { 0, 128, 0, 0, 0, 0 }, { 0, 1, 0, 0, 0, 0 }, { 0, 127, 0, 0, 0, 0 }, { 0, 24, 0, 0, 0, 0 }, { 4, 65536, 8192, 0, 0, 0 }, { 1, 32, 2, 0, 0, 0 }, { -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 }, { -3.40282e+38, 3.40282e+38, -3.40282e+38, 0, 0, 0 }, };

endif /* kn_ck_ut_peg */

jeremysalwen commented 10 years ago

Hi Illicus, thanks for the bug report. Can you tell me which program you're attempting to use kn0ckout with so I can reproduce?

lllucius commented 10 years ago

On 5/25/2014 6:13 PM, Jeremy Salwen wrote:

Hi Illicus, thanks for the bug report. Can you tell me which program you're attempting to use kn0ckout with so I can reproduce? Howdy,

I originally tried with a self built svn version of Audacity. But, I'd be happy to try others if you want. In case it matters, Audacity build is based on:

 lilv-0.16.0
 lv2-1.6.0
 msinttypes-r29
 serd-0.18.2
 sord-0.12.0
 sratom-0.4.2

All other LV2 plugs I've tried with Audacity have worked fine, but kn0ck0ut fails here:

//Latency works out to be exactly the fft size.
*p(p_latency)=gfftSize;

When using the kn0ck0ut that ships with Fedora 20, the stack trace looks like:

0 0x00007fffed176cd7 in AKnockout::run (this=0x1daac40,

sampleFrames=524288) at kn0ck0ut6.cpp:212

1 0x000000000084a16a in lilv_instance_run (instance=0x160efb0,

sample_count=524288) at ../lib-src/lv2/include/lilv/lilv.h:1626

2 0x000000000084caa4 in LV2Effect::ProcessStereo (this=0x17d6ca0,

count=0, left=0x1cc4770, right=0x0, lstart=0, rstart=0, len=1323000) at effects/lv2/LV2Effect.cpp:532

3 0x000000000084c258 in LV2Effect::Process (this=0x17d6ca0) at

effects/lv2/LV2Effect.cpp:414

4 0x0000000000724d70 in Effect::DoEffect (this=0x17d6ca0,

parent=0x17e1260, flags=33, projectRate=44100, list=0x18068b0, factory=0x1833bc0, t0=0x17e15a0, t1=0x17e15a8, params=...) at effects/Effect.cpp:146

5 0x0000000000637490 in AudacityProject::OnEffect (this=0x17e1260,

type=33, f=0x17d6ca0, params=..., saveState=true) at Menus.cpp:2725

They call their kn0ck0ut version:

lv2-kn0ck0ut-1.1-4.0.giteaeb2d90.fc20.x86_64

I've verified that their line 212 is the same line in github.

Leland

jeremysalwen commented 10 years ago

This appears to be an audacity bug. The problem is that audacity is connecting the latency output port to NULL. This port is not optional on kn0ck0ut, and so they are not allowed to do that. A workaround would be to check if it's null before writing to it, and to make the port optional, which would be backwards compatible. I'm going to do this, but I'd suggest filing a report with audacity as well.

lllucius commented 10 years ago

On 5/26/2014 12:32 AM, Jeremy Salwen wrote:

This appears to be an audacity bug. The problem is that audacity is connecting the latency output port to NULL. This port is not optional on kn0ck0ut, and so they are not allowed to do that. A workaround would be to check if it's null before writing to it, and to make the port optional, which would be backwards compatible. I'm going to do this, but I'd suggest filing a report with audacity as well. Thanks, will do.

Leland

jeremysalwen commented 10 years ago

I've committed the change to master

lllucius commented 10 years ago

On 5/26/2014 7:17 PM, Jeremy Salwen wrote:

I've commited the change to master Thanks much. I'll grab a new copy now.

Leland