lavc/hevcdec: move a slice segment sanity check to hls_slice_header()

Combine it with an existing similar check.
This commit is contained in:
Anton Khirnov 2024-06-02 09:00:43 +02:00
parent d43527a1a0
commit 7cce612a26
1 changed files with 2 additions and 6 deletions

View File

@ -1002,7 +1002,8 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb)
sh->slice_ctb_addr_rs = sh->slice_segment_addr; sh->slice_ctb_addr_rs = sh->slice_segment_addr;
if (!s->sh.slice_ctb_addr_rs && s->sh.dependent_slice_segment_flag) { if (sh->dependent_slice_segment_flag &&
(!sh->slice_ctb_addr_rs || !pps->ctb_addr_rs_to_ts[sh->slice_ctb_addr_rs])) {
av_log(s->avctx, AV_LOG_ERROR, "Impossible slice segment.\n"); av_log(s->avctx, AV_LOG_ERROR, "Impossible slice segment.\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@ -2577,11 +2578,6 @@ static int hls_decode_entry(HEVCContext *s, GetBitContext *gb)
int ctb_addr_ts = pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs]; int ctb_addr_ts = pps->ctb_addr_rs_to_ts[s->sh.slice_ctb_addr_rs];
int ret; int ret;
if (!ctb_addr_ts && s->sh.dependent_slice_segment_flag) {
av_log(s->avctx, AV_LOG_ERROR, "Impossible initial tile.\n");
return AVERROR_INVALIDDATA;
}
if (s->sh.dependent_slice_segment_flag) { if (s->sh.dependent_slice_segment_flag) {
int prev_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1]; int prev_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1];
if (s->tab_slice_address[prev_rs] != s->sh.slice_addr) { if (s->tab_slice_address[prev_rs] != s->sh.slice_addr) {