From 4a303edb9e110bf86e69ea393672437e619bccd4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 8 May 2026 12:17:50 +0200 Subject: [PATCH] spa: limit the number of buffer blocks Unbounded values might overflow the stack. --- spa/plugins/audioconvert/audioadapter.c | 1 + spa/plugins/videoconvert/videoadapter.c | 1 + 2 files changed, 2 insertions(+) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index ccc9f48df..b5433bf53 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -507,6 +507,7 @@ static int negotiate_buffers(struct impl *this) if (this->async) buffers = SPA_MAX(2u, buffers); + blocks = SPA_MIN(blocks, 256u); spa_log_info(this->log, "%p: buffers:%d, blocks:%d, size:%d, stride:%d align:%d %d:%d", this, buffers, blocks, size, stride, align, follower_alloc, conv_alloc); diff --git a/spa/plugins/videoconvert/videoadapter.c b/spa/plugins/videoconvert/videoadapter.c index e324b49de..071c5e7d6 100644 --- a/spa/plugins/videoconvert/videoadapter.c +++ b/spa/plugins/videoconvert/videoadapter.c @@ -512,6 +512,7 @@ static int negotiate_buffers(struct impl *this) if (this->async) buffers = SPA_MAX(2u, buffers); + blocks = SPA_MIN(blocks, 256u); spa_log_info(this->log, "%p: buffers:%d, blocks:%d, size:%d, stride:%d align:%d %d:%d", this, buffers, blocks, size, stride, align, follower_alloc, conv_alloc);