avcodec/hevc_parser: Check init_get_bits8() for failure
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 4 Sep 2015 01:09:03 +0000 (03:09 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 4 Sep 2015 01:09:03 +0000 (03:09 +0200)
Fixes: CID1322322

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/hevc_parser.c

index 35cace5..fc10797 100644 (file)
@@ -225,6 +225,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
 
     for (;;) {
         int src_length, consumed;
+        int ret;
         buf = avpriv_find_start_code(buf, buf_end, &state);
         if (--buf + 2 >= buf_end)
             break;
@@ -242,7 +243,10 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
         if (consumed < 0)
             return consumed;
 
-        init_get_bits8(gb, nal->data + 2, nal->size);
+        ret = init_get_bits8(gb, nal->data + 2, nal->size);
+        if (ret < 0)
+            return ret;
+
         switch (h->nal_unit_type) {
         case NAL_VPS:
             ff_hevc_decode_nal_vps(gb, avctx, ps);