PR #23121 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23121
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23121.patch

Fixes: ada-3-poc.mpd

Found-by: Claude and Ada Logics. This issue was found by Anthropic from using 
agents to study security of open source projects, and I am from Ada Logics 
helping validate the found issues and report to maintainers.
Signed-off-by: Michael Niedermayer <[email protected]>


>From c432b0b60d9f1b3054a05a30095f1f0fbdc9769e Mon Sep 17 00:00:00 2001
From: David Korczynski <[email protected]>
Date: Sat, 16 May 2026 20:35:11 +0200
Subject: [PATCH] avformat/dashdec: Skip the per-Representation
 metadata-attachment block when the inner format context produced zero
 streams.

Fixes: ada-3-poc.mpd

Found-by: Claude and Ada Logics. This issue was found by Anthropic from using 
agents to study security of open source projects, and I am from Ada Logics 
helping validate the found issues and report to maintainers.
Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/dashdec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index cf6c542d5f..b4ead34b31 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -2205,6 +2205,8 @@ static int dash_read_header(AVFormatContext *s)
 
     for (i = 0; i < c->n_videos; i++) {
         rep = c->videos[i];
+        if (rep->ctx->nb_streams == 0)
+            continue;
         rep->assoc_stream = av_malloc_array(rep->ctx->nb_streams, 
sizeof(*rep->assoc_stream));
         if (!rep->assoc_stream)
             return AVERROR(ENOMEM);
@@ -2219,6 +2221,8 @@ static int dash_read_header(AVFormatContext *s)
     }
     for (i = 0; i < c->n_audios; i++) {
         rep = c->audios[i];
+        if (rep->ctx->nb_streams == 0)
+            continue;
         rep->assoc_stream = av_malloc_array(rep->ctx->nb_streams, 
sizeof(*rep->assoc_stream));
         if (!rep->assoc_stream)
             return AVERROR(ENOMEM);
@@ -2234,6 +2238,8 @@ static int dash_read_header(AVFormatContext *s)
     }
     for (i = 0; i < c->n_subtitles; i++) {
         rep = c->subtitles[i];
+        if (rep->ctx->nb_streams == 0)
+            continue;
         rep->assoc_stream = av_malloc_array(rep->ctx->nb_streams, 
sizeof(*rep->assoc_stream));
         if (!rep->assoc_stream)
             return AVERROR(ENOMEM);
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to