OSDN Git Service
(root)
/
android-x86
/
external-ffmpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6567c59
)
avcodec/get_bits: Fix get_sbits_long(0)
author
Michael Niedermayer
<michael@niedermayer.cc>
Sat, 3 Dec 2016 22:44:56 +0000
(23:44 +0100)
committer
Michael Niedermayer
<michael@niedermayer.cc>
Sat, 3 Dec 2016 22:45:43 +0000
(23:45 +0100)
Fixes undefined behavior
Fixes: 640889-media
Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/get_bits.h
patch
|
blob
|
history
diff --git
a/libavcodec/get_bits.h
b/libavcodec/get_bits.h
index
0f183e0
..
e888841
100644
(file)
--- a/
libavcodec/get_bits.h
+++ b/
libavcodec/get_bits.h
@@
-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);
}