Skip to content

Crashes in lilv_plugin_get_uis #70

@jcelerier

Description

@jcelerier

I'm seeing crashes with some plug-ins:

LilvUIs*
lilv_plugin_get_uis(const LilvPlugin* plugin)
{
  lilv_plugin_load_if_necessary(plugin);

  LilvUIs* result = lilv_uis_new();

  SordIter* uis = sord_search(plugin->world->model,
                              plugin->plugin_uri->node,
                              plugin->world->uris.ui_ui,
                              NULL,
                              NULL);

  FOREACH_MATCH (uis) {
    const SordNode* ui = sord_iter_get_node(uis, SORD_OBJECT);

    const SordNode* const type =
      lilv_world_get_unique(plugin->world, ui, plugin->world->uris.rdf_type);
    const SordNode* binary =
      lilv_world_get_unique(plugin->world, ui, plugin->world->uris.lv2_binary);
    if (!binary) {
      binary =
        lilv_world_get_unique(plugin->world, ui, plugin->world->uris.ui_binary);
    }

   // Here binary is still null <-----------------------------------------------------------

    if (sord_node_get_type(ui) != SORD_URI ||
        sord_node_get_type(type) != SORD_URI ||
        sord_node_get_type(binary) != SORD_URI) {  <----------- sord_node_get_type does not seem to null-check
      LILV_ERRORF("Corrupt UI <%s>\n", sord_node_get_string(ui));
      continue;
    }

    LilvUI* const lilv_ui = lilv_ui_new(plugin->world, ui, type, binary);
    zix_tree_insert((ZixTree*)result, lilv_ui, NULL);
  }
  sord_iter_free(uis);

  if (lilv_uis_size(result) > 0) {
    return result;
  }

  lilv_uis_free(result);
  return NULL;
}

In the log I'm seeing:

lilv_world_get_unique(): warning: Subject <http://gareus.org/oss/lv2/fil4#ui_gl> has multiple <http://lv2plug.in/ns/extensions/ui#binary> properties

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions