From: Frank Plowman <post@frankplowman.com> To: ffmpeg-devel@ffmpeg.org Cc: Frank Plowman <post@frankplowman.com> Subject: [FFmpeg-devel] [PATCH] lavc/vvc: Only read split_cu_flag if a split is allowed Date: Tue, 02 Apr 2024 21:48:52 +0000 (UTC) Message-ID: <20240402214843.474910-1-post@frankplowman.com> (raw) Add a check to ensure some split is possible before reading the split_cu_flag. This is present in the spec, in VVCv3 section 7.3.11.4. Its omission could lead to infinite loops and ultimately crashing due to stack overflow. --- libavcodec/vvc/vvc_ctu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c index 8ba12c8d9f..32d8bc8f5c 100644 --- a/libavcodec/vvc/vvc_ctu.c +++ b/libavcodec/vvc/vvc_ctu.c @@ -2095,6 +2095,7 @@ static int hls_coding_tree(VVCLocalContext *lc, const int ch_type = tree_type_curr == DUAL_TREE_CHROMA; int ret; VVCAllowedSplit allowed; + int split_cu_flag; if (pps->r->pps_cu_qp_delta_enabled_flag && qg_on_y && cb_sub_div <= sh->cu_qp_delta_subdiv) { lc->parse.is_cu_qp_delta_coded = 0; @@ -2109,7 +2110,11 @@ static int hls_coding_tree(VVCLocalContext *lc, can_split(lc, x0, y0, cb_width, cb_height, mtt_depth, depth_offset, part_idx, last_split_mode, tree_type_curr, mode_type_curr, &allowed); - if (ff_vvc_split_cu_flag(lc, x0, y0, cb_width, cb_height, ch_type, &allowed)) { + if (allowed.btv || allowed.bth || allowed.ttv || allowed.tth || allowed.qt) + split_cu_flag = ff_vvc_split_cu_flag(lc, x0, y0, cb_width, cb_height, ch_type, &allowed); + else + split_cu_flag = 0; + if (split_cu_flag) { VVCSplitMode split = ff_vvc_split_mode(lc, x0, y0, cb_width, cb_height, cqt_depth, mtt_depth, ch_type, &allowed); VVCModeType mode_type = mode_type_decode(lc, x0, y0, cb_width, cb_height, split, ch_type, mode_type_curr); -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2024-04-02 21:49 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-02 21:48 Frank Plowman [this message] 2024-04-03 9:58 ` Frank Plowman 2024-04-03 12:07 ` Nuo Mi
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240402214843.474910-1-post@frankplowman.com \ --to=post@frankplowman.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git