From b4976728c3d1255adc692c3a28b333b03db07259 Mon Sep 17 00:00:00 2001 From: jicksaw Date: Tue, 10 Aug 2021 04:16:22 +0300 Subject: [PATCH] filter-chain: fix parsing when control isn't last Control had to be defined last, because after it the parser would start skipping keys and fail to set rest of the params. --- src/modules/module-filter-chain.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/module-filter-chain.c b/src/modules/module-filter-chain.c index c179f843e..da54f3e78 100644 --- a/src/modules/module-filter-chain.c +++ b/src/modules/module-filter-chain.c @@ -1124,6 +1124,7 @@ static int load_node(struct graph *graph, struct spa_json *json) char label[256] = ""; bool have_control = false; uint32_t i; + int len; while (spa_json_get_string(json, key, sizeof(key)) > 0) { if (spa_streq("type", key)) { @@ -1149,6 +1150,11 @@ static int load_node(struct graph *graph, struct spa_json *json) } else if (spa_streq("control", key)) { it[0] = *json; have_control = true; + len = spa_json_next(json, &val); + if (!spa_json_is_object(val, len)) { + pw_log_error("control expects an object"); + return -EINVAL; + } } else if (spa_json_next(json, &val) < 0) break; }