diff options
author | David Robillard <d@drobilla.net> | 2019-06-21 21:18:43 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-06-21 21:18:43 +0200 |
commit | 1bce600a6f308b3bd836f85eb1cc62d3c93a5f35 (patch) | |
tree | a6b402cee803b8c246603e479c1a34d0d6be72a0 | |
parent | 6d0995694ca5a3de916cc9746f4104f066b22718 (diff) | |
download | lilv-1bce600a6f308b3bd836f85eb1cc62d3c93a5f35.tar.gz lilv-1bce600a6f308b3bd836f85eb1cc62d3c93a5f35.tar.bz2 lilv-1bce600a6f308b3bd836f85eb1cc62d3c93a5f35.zip |
Refuse to store state properties with null keys
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | src/state.c | 4 | ||||
-rw-r--r-- | test/test.lv2/test.c | 10 |
3 files changed, 16 insertions, 2 deletions
@@ -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, |