summaryrefslogtreecommitdiff
path: root/libavcodec/av1_parse.h
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-07-23 13:12:43 -0300
committerJames Almer <jamrial@gmail.com>2018-08-02 12:41:53 -0300
commit4e937b1a60e239335df7623af5eeaa8dd534ee0b (patch)
tree6ba7fa29f958ea00be8db5fe5bc363b08089ac89 /libavcodec/av1_parse.h
parente45ed15594a2553056a577177591fbe55694af44 (diff)
avcodec/av1_parse: check for OBU header overread
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/av1_parse.h')
-rw-r--r--libavcodec/av1_parse.h4
1 files changed, 4 insertions, 0 deletions
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;