From d3576d034e111cc830c455b9244aa812981387b6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 7 Oct 2026 00:06:08 +0200 Subject: [PATCH] avformat/rdt: Allocate the RMStream of a stream only once A repeated ASMRuleBook line allocated a new RMStream for every stream it had already set up, leaking the old one. Memory leak Replicated through UnModified FFmpeg with ASAN Found during triage of the security report PXsIMPp0wPaW --- libavformat/rdt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 725793eb01..7bab6ce522 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -440,6 +440,8 @@ rdt_parse_sdp_line (AVFormatContext *s, int st_index, (count - rdt->nb_rmst) * sizeof(*rdt->rmst)); rdt->nb_rmst = count; } + if (rdt->rmst[s->streams[n]->index]) + continue; rdt->rmst[s->streams[n]->index] = ff_rm_alloc_rmstream(); if (!rdt->rmst[s->streams[n]->index]) return AVERROR(ENOMEM);