avcodec/av1_parse: check for OBU header overread
authorJames Almer <jamrial@gmail.com>
Mon, 23 Jul 2018 16:12:43 +0000 (13:12 -0300)
committerJames Almer <jamrial@gmail.com>
Thu, 2 Aug 2018 15:41:53 +0000 (12:41 -0300)
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/av1_parse.h

index 84fc71c..3a41514 100644 (file)
@@ -118,6 +118,10 @@ static inline int parse_obu_header(const uint8_t *buf, int buf_size,
 
     *obu_size  = has_size_flag ? leb128(&gb)
                                : buf_size - 1 - extension_flag;
+
+    if (get_bits_left(&gb) < 0)
+        return AVERROR_INVALIDDATA;
+
     *start_pos = get_bits_count(&gb) / 8;
 
     return 0;