Skip to content

Lv2: Crash loading sfizz due to missing scale points #8453

Description

@JohannesLorenz

System Information

Irrelevant

LMMS Version(s)

All

Most Recent Working Version

No response

Bug Summary

Sfizz has scale points with duplicate labels:

  ] , [
    a lv2:InputPort, lv2:ControlPort ;
    lv2:index 5 ;
    lv2:symbol "num_voices" ;
    lv2:name "Polyphony",
      "Polyphonie"@fr ,
      "Polifonia"@it ;
    pg:group <http://sfztools.github.io/sfizz#config> ;
    lv2:portProperty pprop:notAutomatic ;
    lv2:portProperty pprop:expensive ;
    lv2:portProperty lv2:integer ;
    lv2:portProperty lv2:enumeration ;
    lv2:default 64 ;
    lv2:minimum 8 ;
    lv2:maximum 256 ;
    lv2:scalePoint [ rdfs:label "8 voices",
      "8 voix"@fr ,
      "8 Voci"@it;
      rdf:value 8
    ] ;
    ...

So, loading it lets lilv fail to load the scale points:

lilv_world_get_unique(): warning: Subject <173b15> has multiple <http://www.w3.org/2000/01/rdf-schema#label> properties
lilv_plugin_get_unique_internal(): error: No value found for (173b15 http://www.w3.org/2000/01/rdf-schema#label ...) property

This later leads to a crash in Lv2Proc::copyModelsFromCore (called by createPorts) in the code line m_res = (*m_scalePointMap)[static_cast<std::size_t>(m.value())];, where m.value() is still 0, but the scalePointMap is entirely empty. For more info, see backtrace in the logs.

Expected Behaviour

Since the port has the enumeration label, it should be displayed with a ComboBox which uses the ScalePoints. Since these are not available though, we have the following options:

  1. enumeration ports without proper scalePoints are displayed as normal knobs instead. The Lv2 core specs say "that the plugin MUST [still] operate reasonably" in that case. However, the danger is that in practice, plugins are not that safe against non-scalePoint maps.
  2. Refuse to load plugins where loading the scalePoints fails. Especially, such plugins might be added to the Lv2 blocklist.

Steps To Reproduce

Open LMMS, load sfizz as Lv2 plugin.

Logs

Click to expand
#4  0x00005555558fa7db in std::vector >::operator[] (this=0x7fffa0011280, __n=0) at /usr/include/c++/16.1.1/bits/stl_vector.h:1272
#5  0x0000555555920c08 in FloatFromModelVisitor::visit (this=0x7fffa58ed610, m=...) at src/core/lv2/Lv2Proc.cpp:242
#6  0x00005555557f56eb in lmms::ComboBoxModel::accept (this=0x7fffa00112b0, v=...) at include/ComboBoxModel.h:41
#7  0x0000555555920d0b in Copy::visit (this=0x7fffa58ed690, ctrl=...) at src/core/lv2/Lv2Proc.cpp:251
#8  0x000055555592f6d7 in lmms::Lv2Ports::VisitablePort::accept (this=0x7fffa0011240, v=...) at include/Lv2Ports.h:150
#9  0x0000555555920ff8 in lmms::Lv2Proc::copyModelsFromCore (this=0x7fffa0001730) at src/core/lv2/Lv2Proc.cpp:273
#10 0x00005555559237a9 in lmms::Lv2Proc::createPorts (this=0x7fffa0001730) at src/core/lv2/Lv2Proc.cpp:805
#11 0x0000555555920854 in lmms::Lv2Proc::Lv2Proc (this=0x7fffa0001730, plugin=0x555556751210, parent=0x7fffa00012f0) at src/core/lv2/Lv2Proc.cpp:200

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

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions