aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-28 13:42:05 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-06 12:40:51 +0100
commit70720f3e4d9e50e2d0f6d5aed8c9b576e60f802c (patch)
tree6539ccd8992b2073d086a1d8576e19f9af765e13
parent9ee155c745b528122a5709b52d4a25fff7aea698 (diff)
downloadffmpeg-70720f3e4d9e50e2d0f6d5aed8c9b576e60f802c.tar.gz
avcodec/hevc: Check max ctb addresses for WPP
Fixes out of array read Fixes: 2f95ddd996db8a6281d2e18c184595a7/asan_heap-oob_192fe91_3330_58e4441181e30a66c19f743dcb392347.bit Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit dad354f38ddc9bfc834bc21358a1d0ad41532ca0) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> Conflicts: libavcodec/hevc.c Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/hevc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 85a0db8f58..d29343b306 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2413,6 +2413,15 @@ static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
int64_t startheader, cmpt = 0;
int i, j, res = 0;
+ if (s->sh.slice_ctb_addr_rs + s->sh.num_entry_point_offsets * s->sps->ctb_width >= s->sps->ctb_width * s->sps->ctb_height) {
+ av_log(s->avctx, AV_LOG_ERROR, "WPP ctb addresses are wrong (%d %d %d %d)\n",
+ s->sh.slice_ctb_addr_rs, s->sh.num_entry_point_offsets,
+ s->sps->ctb_width, s->sps->ctb_height
+ );
+ res = AVERROR_INVALIDDATA;
+ goto error;
+ }
+
ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
if (!s->sList[1]) {