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

Testcase: poc10.bin

Reported-by: Dale Curtis <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>


>From e522714ab81f266d17393d0c2b64ee0954e13296 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Thu, 30 Apr 2026 14:52:15 +0200
Subject: [PATCH] avcodec/h264_refs: Clear stale pointers from ref_list

Testcase: poc10.bin

Reported-by: Dale Curtis <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/h264_refs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index 608e13d7d5..b743858cdc 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -156,8 +156,7 @@ static void h264_initialise_ref_list(H264Context *h, 
H264SliceContext *sl)
                                   h->long_ref, 16, 1, h->picture_structure);
             av_assert0(len <= 32);
 
-            if (len < sl->ref_count[list])
-                memset(&sl->ref_list[list][len], 0, sizeof(H264Ref) * 
(sl->ref_count[list] - len));
+            memset(&sl->ref_list[list][len], 0, sizeof(H264Ref) * (32 - len));
             lens[list] = len;
         }
 
@@ -178,8 +177,7 @@ static void h264_initialise_ref_list(H264Context *h, 
H264SliceContext *sl)
                               h-> long_ref, 16, 1, h->picture_structure);
         av_assert0(len <= 32);
 
-        if (len < sl->ref_count[0])
-            memset(&sl->ref_list[0][len], 0, sizeof(H264Ref) * 
(sl->ref_count[0] - len));
+        memset(&sl->ref_list[0][len], 0, sizeof(H264Ref) * (32 - len));
     }
 #ifdef TRACE
     for (int i = 0; i < sl->ref_count[0]; i++) {
-- 
2.52.0

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

Reply via email to