From af11fb4804c97ad0dee73dba059b7a3d42d15bad Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 5 Jan 2022 17:02:40 +0100 Subject: [PATCH] audioconvert: avoid infinite loop When the follower has no param to enumerate we would keep on enumerating the params of the converter forever. Fix this by setting the next value to something that would then stop the iteration. Also increase the amount of bits for the follower because it might need them. --- spa/plugins/audioconvert/audioadapter.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index b7f80feca..34622a66c 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -118,19 +118,20 @@ static int follower_enum_params(struct impl *this, struct spa_pod_builder *builder) { int res; - if (result->next < 0x10000) { + if (result->next < 0x100000) { if ((res = spa_node_enum_params_sync(this->convert, id, &result->next, filter, &result->param, builder)) == 1) return res; - result->next = 0x10000; + result->next = 0x100000; } - if (result->next >= 0x10000 && this->follower_params_flags[idx] & SPA_PARAM_INFO_READ) { - result->next &= 0xffff; + if (result->next < 0x200000 && this->follower_params_flags[idx] & SPA_PARAM_INFO_READ) { + result->next &= 0xfffff; if ((res = spa_node_enum_params_sync(this->follower, id, &result->next, filter, &result->param, builder)) == 1) { - result->next |= 0x10000; + result->next |= 0x100000; return res; } + result->next = 0x200000; } return 0; }