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

Fixes: out of array access
Fixes: YjwTTD8DawW5
Found-by: Zheng Yu @ Depthfirst



>From 49ae23ea04619c5ce18efa0bbef3f3c34f0f1c54 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Tue, 15 Sep 2026 06:13:53 +0200
Subject: [PATCH] avcodec/ratecontrol: reject picture types other than I, P and
 B in the pass 2 statistics

Fixes: out of array access
Fixes: YjwTTD8DawW5
Found-by: Zheng Yu @ Depthfirst
---
 libavcodec/ratecontrol.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index d48ede909c..ab2c43b8d2 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -628,6 +628,11 @@ av_cold int ff_rate_control_init(MPVMainEncContext *const 
m)
                        i, e);
                 return -1;
             }
+            if (rce->pict_type < AV_PICTURE_TYPE_I || rce->pict_type > 
AV_PICTURE_TYPE_B) {
+                av_log(avctx, AV_LOG_ERROR, "invalid picture type %d at line 
%d\n",
+                       rce->pict_type, i);
+                return -1;
+            }
 
             p = next;
         }
-- 
2.52.0

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

Reply via email to