[FFmpeg-cvslog] hevc: check slice address length

Andreas Cadhalpun git at videolan.org
Fri Jul 10 21:30:04 CEST 2015


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Fri Jul 10 19:41:43 2015 +0200| [05cc8c8e4b7008ff3be8ec477c901b2ceca4b16b] | committer: Andreas Cadhalpun

hevc: check slice address length

It is used as get_bits argument and reading 0 bits isn't supported.

Reviewed-by: Michael Niedermayer <michaelni at gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=05cc8c8e4b7008ff3be8ec477c901b2ceca4b16b
---

 libavcodec/hevc.c        |    2 +-
 libavcodec/hevc_parser.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 38734f0..6ff52ec 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -459,7 +459,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 3c7c3c3..31452f2 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);



More information about the ffmpeg-cvslog mailing list