mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-28 16:20:12 +01:00
Fix dangling pointer bug in lv2 effects
This commit is contained in:
@@ -731,7 +731,7 @@ void LV2Effect::SetSampleRate(double rate)
|
||||
{
|
||||
LV2_Options_Option options[2]; // 2 for empty terminating option
|
||||
memset(&options, 0, sizeof(options));
|
||||
memcpy(&options, mSampleRateOption, sizeof(*mSampleRateOption));
|
||||
memcpy(&options, &mOptions[mSampleRateOption], sizeof(mOptions[0]));
|
||||
|
||||
if (mMaster)
|
||||
{
|
||||
@@ -753,7 +753,7 @@ size_t LV2Effect::SetBlockSize(size_t maxBlockSize)
|
||||
{
|
||||
LV2_Options_Option options[2]; // 2 for empty terminating option
|
||||
memset(&options, 0, sizeof(options));
|
||||
memcpy(&options, mBlockSizeOption, sizeof(*mBlockSizeOption));
|
||||
memcpy(&options, &mOptions[mBlockSizeOption], sizeof(mOptions[0]));
|
||||
|
||||
if (mMaster)
|
||||
{
|
||||
@@ -1342,7 +1342,7 @@ bool LV2Effect::SaveParameters(const wxString & group)
|
||||
return mHost->SetPrivateConfig(group, wxT("Parameters"), parms);
|
||||
}
|
||||
|
||||
LV2_Options_Option *LV2Effect::AddOption(const char *key, uint32_t size, const char *type, void *value)
|
||||
size_t LV2Effect::AddOption(const char *key, uint32_t size, const char *type, void *value)
|
||||
{
|
||||
int ndx = mNumOptions;
|
||||
|
||||
@@ -1360,7 +1360,7 @@ LV2_Options_Option *LV2Effect::AddOption(const char *key, uint32_t size, const c
|
||||
mOptions[ndx].value = value;
|
||||
}
|
||||
|
||||
return &mOptions[ndx];
|
||||
return ndx;
|
||||
}
|
||||
|
||||
LV2_Feature *LV2Effect::AddFeature(const char *uri, void *data)
|
||||
|
||||
@@ -204,7 +204,7 @@ private:
|
||||
static int ui_resize(LV2UI_Feature_Handle handle, int width, int height);
|
||||
int UIResize(int width, int height);
|
||||
|
||||
LV2_Options_Option *AddOption(const char *key, uint32_t size, const char *type, void *value);
|
||||
size_t AddOption(const char *key, uint32_t size, const char *type, void *value);
|
||||
LV2_Feature *AddFeature(const char *uri, void *data);
|
||||
|
||||
bool BuildFancy();
|
||||
@@ -295,8 +295,8 @@ private:
|
||||
LV2UI_Resize mUIResizeFeature;
|
||||
LV2_Extension_Data_Feature mExtDataFeature;
|
||||
|
||||
LV2_Options_Option *mBlockSizeOption;
|
||||
LV2_Options_Option *mSampleRateOption;
|
||||
size_t mBlockSizeOption;
|
||||
size_t mSampleRateOption;
|
||||
|
||||
LV2_Options_Interface *mOptionsInterface;
|
||||
LV2_Options_Option *mOptions;
|
||||
|
||||
Reference in New Issue
Block a user