From 853c16538614b2e6828e8a9eb620f61bf0b9b3da Mon Sep 17 00:00:00 2001 From: James Almer Date: Tue, 27 Aug 2024 09:52:36 -0300 Subject: [PATCH] avcodec/cbs_h265: fix valid range for {left,right}_view_id view_id_len in VPS is 4 bits, so view_id values can be up to 15 bits long. Signed-off-by: James Almer --- libavcodec/cbs_h265.h | 4 ++-- libavcodec/cbs_h265_syntax_template.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h index 26a5a34fe9..580c6cd4f4 100644 --- a/libavcodec/cbs_h265.h +++ b/libavcodec/cbs_h265.h @@ -725,8 +725,8 @@ typedef struct H265RawSEI3DReferenceDisplaysInfo { uint8_t ref_viewing_distance_flag; uint8_t prec_ref_viewing_dist; uint8_t num_ref_displays_minus1; - uint8_t left_view_id[31]; - uint8_t right_view_id[31]; + uint16_t left_view_id[31]; + uint16_t right_view_id[31]; uint8_t exponent_ref_display_width[31]; uint8_t mantissa_ref_display_width[31]; uint8_t exponent_ref_viewing_distance[31]; diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c index 1c11514435..e976c38b8d 100644 --- a/libavcodec/cbs_h265_syntax_template.c +++ b/libavcodec/cbs_h265_syntax_template.c @@ -2299,8 +2299,8 @@ SEI_FUNC(sei_3d_reference_displays_info, (CodedBitstreamContext *ctx, RWContext ue(prec_ref_viewing_dist, 0, 31); ue(num_ref_displays_minus1, 0, 31); for (i = 0; i <= current->num_ref_displays_minus1; i++) { - ues(left_view_id[i], 0, UINT8_MAX, 1, i); - ues(right_view_id[i], 0, UINT8_MAX, 1, i); + ues(left_view_id[i], 0, MAX_UINT_BITS(15), 1, i); + ues(right_view_id[i], 0, MAX_UINT_BITS(15), 1, i); us(6, exponent_ref_display_width[i], 0, 62, 1, i); if (!current->exponent_ref_display_width[i]) length = FFMAX(0, (int)current->prec_ref_display_width - 30);