Commit d3576d034e for ffmpeg
commit d3576d034e111cc830c455b9244aa812981387b6
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Wed Oct 7 00:06:08 2026 +0200
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
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);