[FFmpeg-cvslog] lavc/hevcdec: move a slice segment sanity check to hls_slice_header()

Anton Khirnov git at videolan.org
Tue Jun 11 18:51:14 EEST 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Jun  2 09:00:43 2024 +0200| [7cce612a26c3bd750b4a64db6e31ce370b067993] | committer: Anton Khirnov

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

Combine it with an existing similar check.

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

 libavcodec/hevc/hevcdec.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index df6d1565bc..9c1d879953 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -1002,7 +1002,8 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb)
 
     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");
         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 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) {
         int prev_rs = pps->ctb_addr_ts_to_rs[ctb_addr_ts - 1];
         if (s->tab_slice_address[prev_rs] != s->sh.slice_addr) {



More information about the ffmpeg-cvslog mailing list