diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-07-10 19:41:43 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-23 01:37:36 +0200 |
commit | 44a9e2dbba3ad3c5543a3e355dd44641eafe0fa8 (patch) | |
tree | 1ebf63d82381b671d93161596da8d990c8029f7f | |
parent | 2d89356641f89cad9dc4ee961fa1cecf1e0f548e (diff) | |
download | ffmpeg-44a9e2dbba3ad3c5543a3e355dd44641eafe0fa8.tar.gz |
hevc: check slice address length
It is used as get_bits argument and reading 0 bits isn't supported.
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 05cc8c8e4b7008ff3be8ec477c901b2ceca4b16b)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit f06d9dced4c7267008beae45f28ce4e1848ef403)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/hevc.c | 2 | ||||
-rw-r--r-- | libavcodec/hevc_parser.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index 8871ccd62d..3f6429f528 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -440,7 +440,7 @@ static int hls_slice_header(HEVCContext *s) slice_address_length = av_ceil_log2(s->sps->ctb_width * s->sps->ctb_height); - sh->slice_segment_addr = get_bits(gb, slice_address_length); + sh->slice_segment_addr = slice_address_length ? get_bits(gb, slice_address_length) : 0; if (sh->slice_segment_addr >= s->sps->ctb_width * s->sps->ctb_height) { av_log(s->avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c index a6fdbb722d..f5354aae6e 100644 --- a/libavcodec/hevc_parser.c +++ b/libavcodec/hevc_parser.c @@ -200,7 +200,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx slice_address_length = av_ceil_log2_c(h->sps->ctb_width * h->sps->ctb_height); - sh->slice_segment_addr = get_bits(gb, slice_address_length); + sh->slice_segment_addr = slice_address_length ? get_bits(gb, slice_address_length) : 0; if (sh->slice_segment_addr >= h->sps->ctb_width * h->sps->ctb_height) { av_log(h->avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", sh->slice_segment_addr); |