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 12:20:15 +0200
commit8bf18194abd6abfe84af4f9c39a54c5c18c15c2c (patch)
treefbb4abbae9ecdd2bbbb413522ee0a5810830e765
parent57e603fd9f14cde0336d8e98b3ced28741779e19 (diff)
downloadffmpeg-8bf18194abd6abfe84af4f9c39a54c5c18c15c2c.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 e4cef61811..388d8dee78 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -155,8 +155,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);
}