[FFmpeg-devel] [PATCH v2 1/2] avcodec/cbs_h266: fix use of uninitialized value

James Almer jamrial at gmail.com
Thu Jul 6 19:50:36 EEST 2023


And fix the allowed range for ph_log2_diff_max_bt_min_qt_intra_slice_luma while at it.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/cbs_h266_syntax_template.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index b984a12d8f..29eb9b70ed 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -2730,9 +2730,14 @@ static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw,
                0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
             ue(ph_max_mtt_hierarchy_depth_intra_slice_luma,
                0, 2 * (ctb_log2_size_y - min_cb_log2_size_y));
+            min_qt_log2_size_intra_y =
+                current->ph_log2_diff_min_qt_min_cb_intra_slice_luma +
+                min_cb_log2_size_y;
             if (current->ph_max_mtt_hierarchy_depth_intra_slice_luma != 0) {
                 ue(ph_log2_diff_max_bt_min_qt_intra_slice_luma,
-                   0, ctb_log2_size_y - min_qt_log2_size_intra_y);
+                   0, (sps->sps_qtbtt_dual_tree_intra_flag ?
+                       FFMIN(6, ctb_log2_size_y) :
+                       ctb_log2_size_y) - min_qt_log2_size_intra_y);
                 ue(ph_log2_diff_max_tt_min_qt_intra_slice_luma,
                    0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_y);
             } else {
-- 
2.41.0



More information about the ffmpeg-devel mailing list