You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-05-16 08:38:24 +02:00
avcodec/get_bits: Fix get_sbits_long(0)
Fixes undefined behavior
Fixes: 640889-media
Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c72fa43234)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -374,6 +374,10 @@ static inline uint64_t get_bits64(GetBitContext *s, int n)
|
|||||||
*/
|
*/
|
||||||
static inline int get_sbits_long(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);
|
return sign_extend(get_bits_long(s, n), n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user