diff options
author | James Almer <jamrial@gmail.com> | 2018-07-30 15:14:24 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2018-08-02 12:41:54 -0300 |
commit | 692e323d893190051c488931bf15eb5c7d340f74 (patch) | |
tree | c75c2d1aa236732a48576a481a3abade6b3cf7d1 /libavcodec/av1_parse.h | |
parent | 1e126560c2792e2e141167fb138d6ad1bfed7b39 (diff) | |
download | ffmpeg-692e323d893190051c488931bf15eb5c7d340f74.tar.gz |
avcodec/av1_parse: return size of the parsed OBU in parse_obu_header()
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/av1_parse.h')
-rw-r--r-- | libavcodec/av1_parse.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/av1_parse.h b/libavcodec/av1_parse.h index 3a4151491a..9a6e6835ab 100644 --- a/libavcodec/av1_parse.h +++ b/libavcodec/av1_parse.h @@ -95,6 +95,7 @@ static inline int parse_obu_header(const uint8_t *buf, int buf_size, { GetBitContext gb; int ret, extension_flag, has_size_flag; + int64_t size; ret = init_get_bits8(&gb, buf, FFMIN(buf_size, 2 + 8)); // OBU header fields + max leb128 length if (ret < 0) @@ -124,7 +125,12 @@ static inline int parse_obu_header(const uint8_t *buf, int buf_size, *start_pos = get_bits_count(&gb) / 8; - return 0; + size = *obu_size + *start_pos; + + if (size > INT_MAX) + return AVERROR(ERANGE); + + return size; } #endif /* AVCODEC_AV1_PARSE_H */ |