summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <[email protected]>2015-11-28 13:42:05 +0100
committerMichael Niedermayer <[email protected]>2015-12-06 02:51:27 +0100
commitce6dd54711b383ab0de1555c369e876ac1906dd8 (patch)
treef48536f31eb8018a19f957f23df7df5d4a884bb8
parentd32c9723a626701a5a508db7ceba9e8b8a774921 (diff)
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 <[email protected]> (cherry picked from commit dad354f38ddc9bfc834bc21358a1d0ad41532ca0) Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r--libavcodec/hevc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index f7ede4db6b..1f9069b4e6 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2450,6 +2450,15 @@ static int hls_slice_data_wpp(HEVCContext *s, const HEVCNAL *nal)
return AVERROR(ENOMEM);
}
+ if (s->sh.slice_ctb_addr_rs + s->sh.num_entry_point_offsets * s->ps.sps->ctb_width >= s->ps.sps->ctb_width * s->ps.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->ps.sps->ctb_width, s->ps.sps->ctb_height
+ );
+ res = AVERROR_INVALIDDATA;
+ goto error;
+ }
+
ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
if (!s->sList[1]) {