Commit c72fa432 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/get_bits: Fix get_sbits_long(0)

Fixes undefined behavior
Fixes: 640889-media
Found-by: 's avatarMatt Wolenetz <wolenetz@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 6567c59c
......@@ -369,6 +369,10 @@ static inline uint64_t get_bits64(GetBitContext *s, int n)
*/
static inline int get_sbits_long(GetBitContext *s, int n)
{
// sign_extend(x, 0) is undefined
if (!n)
return 0;
return sign_extend(get_bits_long(s, n), n);
}
......
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