Commit b9289fad authored by Michael Niedermayer's avatar Michael Niedermayer

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/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 7b6a51f5)
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent ff27d173
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment