diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-06 18:28:09 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-17 20:35:19 +0200 |
commit | 9f4e2b15e0d8cf1892029b7a470908c0e740f23a (patch) | |
tree | fba79e1d4f5debeeeab52ccfe18660a477aac033 | |
parent | 65ec573358b3831bd482216413af40294240efe7 (diff) | |
download | ffmpeg-9f4e2b15e0d8cf1892029b7a470908c0e740f23a.tar.gz |
avcodec/shorten: Check k in get_uint()
Fixes: undefined shift
Fixes: 1371/clusterfuzz-testcase-minimized-5770822591447040
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7b6a51f59c467ab9f4b73122dc269206fb517425)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/shorten.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index 0f5be96eb7..32f808beb4 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -156,8 +156,11 @@ static int allocate_buffers(ShortenContext *s) static inline unsigned int get_uint(ShortenContext *s, int k) { - if (s->version != 0) + if (s->version != 0) { k = get_ur_golomb_shorten(&s->gb, ULONGSIZE); + if (k > 31U) + return AVERROR_INVALIDDATA; + } return get_ur_golomb_shorten(&s->gb, k); } |