[FFmpeg-devel] [PATCH 3/5] avcodec/av1_parse: check for OBU header overread

James Almer jamrial at gmail.com
Thu Jul 26 04:11:49 EEST 2018


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/av1_parse.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/av1_parse.h b/libavcodec/av1_parse.h
index 84fc71c925..3a4151491a 100644
--- a/libavcodec/av1_parse.h
+++ b/libavcodec/av1_parse.h
@@ -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;
-- 
2.18.0



More information about the ffmpeg-devel mailing list