aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-05-06 18:28:09 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-20 03:41:33 +0200
commitb9289fad4b0b132ccb4ec71543a79240016ecd6a (patch)
treec718e69e0ea7ca9f12a05348aea6d2965a0ab4a8
parentff27d173489c52fb8a3bcfc65257111e9b721314 (diff)
downloadffmpeg-b9289fad4b0b132ccb4ec71543a79240016ecd6a.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.c5
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);
}