Opened 2 years ago

Closed 2 years ago

#1105 closed Bug Report (fixed)

State restore doesn't check if state interface is valid

Reported by: falkTX Owned by: dave
Priority: major Component: Lilv
Keywords: Cc:


In the lilv_state_restore function iface->restore is called without checking if it's null.
This results in crashes for plugins that don't use the lv2 state interface.

Easy to fix, just check if the interface and restore functions are not null.

--- lilv-static-0.22.1+svn5800.orig/src/state.c
+++ lilv-static-0.22.1+svn5800/src/state.c
@@ -436,13 +436,15 @@ lilv_state_restore(const LilvState*
 			const LV2_State_Interface* iface = (const LV2_State_Interface*)
-			const LV2_Feature** sfeatures = add_features(
-				features, &map_feature, NULL);
+			if (iface && iface->restore) {
+				const LV2_Feature** sfeatures = add_features(
+					features, &map_feature, NULL);
-			iface->restore(instance->lv2_handle, retrieve_callback,
-			               (LV2_State_Handle)state, flags, sfeatures);
+				iface->restore(instance->lv2_handle, retrieve_callback,
+				               (LV2_State_Handle)state, flags, sfeatures);
-			free(sfeatures);
+				free(sfeatures);
+			}

Change History (1)

comment:1 Changed 2 years ago by dave

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r5802

Note: See TracTickets for help on using tickets.