Browse Source

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>
tags/n2.8
Andreas Cadhalpun 10 years ago
parent
commit
05cc8c8e4b
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      libavcodec/hevc.c
  2. +1
    -1
      libavcodec/hevc_parser.c

+ 1
- 1
libavcodec/hevc.c View File

@@ -459,7 +459,7 @@ static int hls_slice_header(HEVCContext *s)


slice_address_length = av_ceil_log2(s->sps->ctb_width * slice_address_length = av_ceil_log2(s->sps->ctb_width *
s->sps->ctb_height); 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) { if (sh->slice_segment_addr >= s->sps->ctb_width * s->sps->ctb_height) {
av_log(s->avctx, AV_LOG_ERROR, av_log(s->avctx, AV_LOG_ERROR,
"Invalid slice segment address: %u.\n", "Invalid slice segment address: %u.\n",


+ 1
- 1
libavcodec/hevc_parser.c View File

@@ -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 * slice_address_length = av_ceil_log2_c(h->sps->ctb_width *
h->sps->ctb_height); 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) { 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", av_log(h->avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n",
sh->slice_segment_addr); sh->slice_segment_addr);


Loading…
Cancel
Save