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-14 00:21:49 +0200
commit2ff5e3f54e9543065bfb2a2a56f1696a7f885b52 (patch)
tree72f54a509c28f0638406a20490230a21c96e3984
parent28c618355c9f4e61d3f30ad831eadb74a7e3fd1d (diff)
downloadffmpeg-2ff5e3f54e9543065bfb2a2a56f1696a7f885b52.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 90569bdb1f..2d3540a229 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -160,8 +160,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);
}