This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 4da74f951349f82e77cebc00be64423ccf8f6844
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Wed Nov 18 15:52:20 2026 +0100
Commit:     michaelni <[email protected]>
CommitDate: Thu Nov 19 03:51:55 2026 +0000

    avformat/rtpdec_av1: assemble the temporal unit in a packet of the 
PayloadContext instead of the caller's shared AVPacket
    
    Fixes: out of array write
    Fixes: lpyS49qp7Khk
    Fixes: ANT-2026-8V3C20FG
    Found-by: Anthropic's OSS Scanner
    
    Out of array write Replicated through UnModified FFmpeg with ASAN
---
 libavformat/rtpdec_av1.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/libavformat/rtpdec_av1.c b/libavformat/rtpdec_av1.c
index a45a2f149d..61d765488d 100644
--- a/libavformat/rtpdec_av1.c
+++ b/libavformat/rtpdec_av1.c
@@ -44,6 +44,7 @@
  * RTP/AV1 specific private data.
  */
 struct PayloadContext {
+    AVPacket *pkt;      ///< temporal unit being assembled
     uint32_t timestamp; ///< last received timestamp for frame
     uint8_t profile;    ///< profile (main/high/professional)
     uint8_t level_idx;  ///< level (0-31)
@@ -78,9 +79,10 @@ static int sdp_parse_fmtp_config_av1(AVFormatContext *s,
 
 // return 0 on complete packet, -1 on partial packet
 static int av1_handle_packet(AVFormatContext *ctx, PayloadContext *data,
-                             AVStream *st, AVPacket *pkt, uint32_t *timestamp,
+                             AVStream *st, AVPacket *out_pkt, uint32_t 
*timestamp,
                              const uint8_t *buf, int len, uint16_t seq,
                              int flags) {
+    AVPacket *pkt = data->pkt;
     uint8_t aggr_hdr;
     int result = 0;
     int is_frag_cont;
@@ -398,6 +400,11 @@ static int av1_handle_packet(AVFormatContext *ctx, 
PayloadContext *data,
 #endif
     pkt->stream_index = st->index;
 
+    if (!result) {
+        av_packet_unref(out_pkt);
+        av_packet_move_ref(out_pkt, pkt);
+    }
+
     return result;
 
 drop_fragment:
@@ -413,7 +420,19 @@ drop_fragment:
     return AVERROR_INVALIDDATA;
 }
 
+static av_cold int av1_init(AVFormatContext *s, int st_index,
+                            PayloadContext *data)
+{
+    if (!data->pkt)
+        data->pkt = av_packet_alloc();
+    if (!data->pkt)
+        return AVERROR(ENOMEM);
+
+    return 0;
+}
+
 static void av1_close_context(PayloadContext *data) {
+    av_packet_free(&data->pkt);
 }
 
 static int av1_need_keyframe(PayloadContext *data)
@@ -450,6 +469,7 @@ const RTPDynamicProtocolHandler ff_av1_dynamic_handler = {
         .need_parsing     = AVSTREAM_PARSE_FULL,
         .priv_data_size   = sizeof(PayloadContext),
         .parse_sdp_a_line = parse_av1_sdp_line,
+        .init             = av1_init,
         .close            = av1_close_context,
         .parse_packet     = av1_handle_packet,
         .need_keyframe    = av1_need_keyframe,

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to