summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--src/state.c4
-rw-r--r--test/test.lv2/test.c10
3 files changed, 16 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 023c580..5a0a69a 100644
--- a/NEWS
+++ b/NEWS
@@ -6,9 +6,9 @@ lilv (0.24.5) unstable;
* Fix issues with loading state with saved files from the model
* Add option to override LV2_PATH in applications
* Fix unit tests on Windows
- * Refuse to store duplicate properties when saving plugin state
+ * Add more strict error detection when storing plugin state properties
- -- David Robillard <d@drobilla.net> Fri, 21 Jun 2019 21:00:52 +0200
+ -- David Robillard <d@drobilla.net> Fri, 21 Jun 2019 21:18:02 +0200
lilv (0.24.4) stable;
diff --git a/src/state.c b/src/state.c
index 9b44c42..ac1468c 100644
--- a/src/state.c
+++ b/src/state.c
@@ -193,6 +193,10 @@ store_callback(LV2_State_Handle handle,
{
LilvState* const state = (LilvState*)handle;
+ if (!key) {
+ return LV2_STATE_ERR_UNKNOWN; // TODO: Add status for bad arguments
+ }
+
if (find_property((const LilvState*)handle, key)) {
return LV2_STATE_ERR_UNKNOWN; // TODO: Add status for duplicate keys
}
diff --git a/test/test.lv2/test.c b/test/test.lv2/test.c
index bf0f87b..c1cf4d7 100644
--- a/test/test.lv2/test.c
+++ b/test/test.lv2/test.c
@@ -213,6 +213,16 @@ save(LV2_Handle instance,
return LV2_STATE_ERR_UNKNOWN;
}
+ // Try to store with a null key (should fail)
+ if (!store(callback_data,
+ 0,
+ &urid2,
+ sizeof(uint32_t),
+ map_uri(plugin, LV2_ATOM__URID),
+ LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE)) {
+ return LV2_STATE_ERR_UNKNOWN;
+ }
+
store(callback_data,
map_uri(plugin, "http://example.org/num-runs"),
&plugin->num_runs,