[FFmpeg-cvslog] avcodec/cbs_h266: use VVC_MAX_VPS_COUNT for range checks and array size

James Almer git at videolan.org
Fri Jun 30 14:44:08 EEST 2023


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Jun 30 08:42:07 2023 -0300| [96d69905171be47369839f8e8d3e6036f91df74f] | committer: James Almer

avcodec/cbs_h266: use VVC_MAX_VPS_COUNT for range checks and array size

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=96d69905171be47369839f8e8d3e6036f91df74f
---

 libavcodec/cbs_h266.h                 | 2 +-
 libavcodec/cbs_h266_syntax_template.c | 7 +------
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h
index 54590748c3..be3c744426 100644
--- a/libavcodec/cbs_h266.h
+++ b/libavcodec/cbs_h266.h
@@ -775,7 +775,7 @@ typedef struct CodedBitstreamH266Context {
     AVBufferRef *sps_ref[VVC_MAX_SPS_COUNT];
     AVBufferRef *pps_ref[VVC_MAX_PPS_COUNT];
     AVBufferRef *ph_ref;
-    H266RawVPS  *vps[VVC_MAX_SPS_COUNT];
+    H266RawVPS  *vps[VVC_MAX_VPS_COUNT];
     H266RawSPS  *sps[VVC_MAX_SPS_COUNT];
     H266RawPPS  *pps[VVC_MAX_PPS_COUNT];
     H266RawPictureHeader *ph;
diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index b23a80d356..863fecdefa 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -639,12 +639,7 @@ static int FUNC(vps) (CodedBitstreamContext *ctx, RWContext *rw,
     CHECK(FUNC(nal_unit_header) (ctx, rw,
                                  &current->nal_unit_header, VVC_VPS_NUT));
 
-    ub(4, vps_video_parameter_set_id);
-    if (current->vps_video_parameter_set_id == 0) {
-        av_log(ctx->log_ctx, AV_LOG_ERROR,
-               "vps_video_parameter_set_id should > 0.\n");
-        return AVERROR_INVALIDDATA;
-    }
+    u(4, vps_video_parameter_set_id, 1, VVC_MAX_VPS_COUNT - 1);
     ub(6, vps_max_layers_minus1);
     u(3, vps_max_sublayers_minus1, 0, 6);
     if (current->vps_max_layers_minus1 > 0



More information about the ffmpeg-cvslog mailing list