aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-18 02:52:41 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-18 02:57:03 +0200
commit6998af4a40e67b5f0bfb769b7749f38a92eb2819 (patch)
tree325c31e1745fed6820092d8d60fb4e1008c28efe
parentfb3e3808aed843b21dd70a70bdbc4b9f7de6a00b (diff)
downloadffmpeg-6998af4a40e67b5f0bfb769b7749f38a92eb2819.tar.gz
avcodec/bitstream: check codes in ff_init_vlc_sparse()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/bitstream.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 6598d3e397..2dda9bbf7b 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -310,6 +310,10 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
return -1;\
}\
GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);\
+ if (buf[j].code >= (1LL<<buf[j].bits)) {\
+ av_log(NULL, AV_LOG_ERROR, "Invalid code in init_vlc\n");\
+ return -1;\
+ }\
if (flags & INIT_VLC_LE)\
buf[j].code = bitswap_32(buf[j].code);\
else\