]> git.sesse.net Git - ffmpeg/commitdiff
hevc: Reject impossible slice segment
authorLuca Barbato <lu_zero@gentoo.org>
Sat, 11 Jan 2014 10:32:07 +0000 (11:32 +0100)
committerLuca Barbato <lu_zero@gentoo.org>
Sat, 1 Feb 2014 16:04:49 +0000 (17:04 +0100)
A dependent slice cannot have address 0.
Prevent an out of array bound load in ff_hevc_cabac_init().

Sample-Id: 00001406-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavcodec/hevc.c

index 859b2abade89a3c8ec34bd13b6774012127ad2a1..bc89b17f26838165ae839ec011e5c458a43219fc 100644 (file)
@@ -779,6 +779,11 @@ static int hls_slice_header(HEVCContext *s)
 
     sh->slice_ctb_addr_rs = sh->slice_segment_addr;
 
+    if (!s->sh.slice_ctb_addr_rs && s->sh.dependent_slice_segment_flag) {
+        av_log(s->avctx, AV_LOG_ERROR, "Impossible slice segment.\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     s->HEVClc.first_qp_group = !s->sh.dependent_slice_segment_flag;
 
     if (!s->pps->cu_qp_delta_enabled_flag)