Skip to content

Lv2 "Audio Gain Stereo" causes crash #8425

@JohannesLorenz

Description

@JohannesLorenz

System Information

Arch Linux latest, Plasma 6.6.5-1 + Wayland

LMMS Version(s)

master

Most Recent Working Version

33d1bad~1

Bug Summary

Loading http://kxstudio.sf.net/carla/plugins/audiogain_s on master causes an instant crash:

/usr/include/c++/16.1.1/optional:1235: constexpr _Tp* std::optional<_Tp>::operator->() [with _Tp = lmms::Lv2Worker]: Assertion 'this->_M_is_engaged()' failed.

This means that LMMS tries to access the Lv2 Worker extension data. However, the plugin does not provide it.

The reason behind this is that there are 2 functions:

  1. lilv_plugin_has_extension_data checks whether a plugin has extension data due to its TTL metadata
  2. lilv_instance_get_extension_data tries to execute the extension_data function directly on the plugin instance

The LMMS master implementation first emplaces the Lv2Worker iff lilv_plugin_has_extension_data returns true and later calls Lv2Worker::setHandle (and others) iff lilv_instance_get_extension_data returns non-null. This means inconsistent plugins can cause accessing non-instantiated pointers.

So the fix is to only call lilv_instance_get_extension_data if lilv_plugin_has_extension_data has indicated that this extension data exists - Ardour indeed does the same.

Note: I already have a fix and will provide it soon.

Expected Behaviour

No crash.

LMMS should not try to access the Lv2 Worker extension data because the plugin does not provide it.

Steps To Reproduce

  1. Start LMMS
  2. Add an effect anywhere -> Lv2 Effects -> Search for Gain -> Add http://kxstudio.sf.net/carla/plugins/audiogain_s

Logs

Click to expand
(gdb) bt
#0  0x00007ffff589a29c in ?? () from /usr/lib/libc.so.6
#1  0x00007ffff583e7d0 in raise () from /usr/lib/libc.so.6
#2  0x00007ffff5825681 in abort () from /usr/lib/libc.so.6
#3  0x00007ffff5c9d5b9 in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /usr/lib/libstdc++.so.6
#4  0x0000555555a756f6 in std::optional::operator-> (this=0x555556ef6288) at /usr/include/c++/16.1.1/optional:1235
#5  0x0000555555a703c7 in lmms::Lv2Proc::initPlugin (this=0x555556ef6140) at src/core/lv2/Lv2Proc.cpp:451
#6  0x0000555555a6f17f in lmms::Lv2Proc::Lv2Proc (this=0x555556ef6140, plugin=0x555556f80e50, parent=0x555558c79170) at src/core/lv2/Lv2Proc.cpp:201
#7  0x0000555555a670c5 in std::make_unique () at /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
#8  0x0000555555a66347 in lmms::Lv2ControlBase::init (this=0x555558c791b0, meAsModel=0x555558c79170) at src/core/lv2/Lv2ControlBase.cpp:80
#9  0x0000555555a66157 in lmms::Lv2ControlBase::Lv2ControlBase (this=0x555558c791b0, that=0x555558c79170, uri=...) at src/core/lv2/Lv2ControlBase.cpp:58
#10 0x00007fffb805c62c in lmms::Lv2FxControls::Lv2FxControls (this=0x555558c79140, effect=0x555558c78c20, uri=...) at plugins/Lv2Effect/Lv2FxControls.cpp:38
#11 0x00007fffb80585a2 in lmms::Lv2Effect::Lv2Effect (this=0x555558c78c20, parent=0x555557152fd0, key=0x7fffffffc2e0) at plugins/Lv2Effect/Lv2Effect.cpp:63
#12 0x00007fffb8058957 in lmms::lmms_plugin_main (_parent=0x555557152fd0, _data=0x7fffffffc2e0) at plugins/Lv2Effect/Lv2Effect.cpp:108
#13 0x00005555559eba89 in lmms::Plugin::instantiate (pluginName=..., parent=0x555557152fd0, data=0x7fffffffc2e0) at src/core/Plugin.cpp:231
#14 0x00005555559eb6fc in lmms::Plugin::instantiateWithKey (pluginName=..., parent=0x555557152fd0, key=0x7fffffffc460, keyFromDnd=false) at src/core/Plugin.cpp:197
#15 0x000055555598c7f5 in lmms::Effect::instantiate (pluginName=..., _parent=0x555557152fd0, _key=0x7fffffffc460) at src/core/Effect.cpp:154
#16 0x0000555555bd7cb0 in lmms::gui::EffectSelectDialog::instantiateSelectedPlugin (this=0x7fffffffc420, parent=0x555557152fd0) at src/gui/modals/EffectSelectDialog.cpp:201
#17 0x0000555555ab6b26 in lmms::gui::EffectRackView::addEffect (this=0x555557fe67d0) at src/gui/EffectRackView.cpp:247

Screenshots / Minimum Reproducible Project

No response

Please search the issue tracker for existing bug reports before submitting your own.

  • I have searched all existing issues and confirmed that this is not a duplicate.

Metadata

Metadata

Labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions