summaryrefslogtreecommitdiff
path: root/libavcodec/hevc.c
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@gmail.com>2014-08-10 19:22:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-11 02:47:05 +0200
commit5ec85c9750f0770383b781acd6362a8bebbf4db6 (patch)
treee0f88a13014fd147c6c9a85c98627fe94f7290f2 /libavcodec/hevc.c
parentbfffce4d081c87b9fadcc0ce3fb5309cf8f266e5 (diff)
hevc: do generic validation of bitstream
After finishing parsing VPS/SPS/PPS/slice header, check remaining bits, and if an overconsumption occurred, report invalid data. Liked-by: BBB Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/hevc.c')
-rw-r--r--libavcodec/hevc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 829b5d1969..3170d8496e 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -740,6 +740,12 @@ static int hls_slice_header(HEVCContext *s)
return AVERROR_INVALIDDATA;
}
+ if (get_bits_left(gb) < 0) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Overread slice header by %d bits\n", -get_bits_left(gb));
+ return AVERROR_INVALIDDATA;
+ }
+
s->HEVClc->first_qp_group = !s->sh.dependent_slice_segment_flag;
if (!s->pps->cu_qp_delta_enabled_flag)