aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cabac.c
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-12-22 02:37:08 -0500
committerSteve Kondik <steve@cyngn.com>2015-12-22 02:37:08 -0500
commitbc1e061c245cfb1d8a8fdd52cfa394bf117f770a (patch)
tree05f33f51bab749a67c82c67ae34a4f83edeb903a /libavcodec/cabac.c
parenta4a2a44d6836e2f58d9112bdb384e4f2cfac905d (diff)
parent79f407b79a825c3123aff65cef64b383eca5a95e (diff)
downloadandroid_external_ffmpeg-bc1e061c245cfb1d8a8fdd52cfa394bf117f770a.tar.gz
android_external_ffmpeg-bc1e061c245cfb1d8a8fdd52cfa394bf117f770a.tar.bz2
android_external_ffmpeg-bc1e061c245cfb1d8a8fdd52cfa394bf117f770a.zip
Merge branch 'release/2.8' of https://github.com/FFmpeg/FFmpeg into cm-13.0
Diffstat (limited to 'libavcodec/cabac.c')
-rw-r--r--libavcodec/cabac.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c
index 8cc9333e09..f298336ea4 100644
--- a/libavcodec/cabac.c
+++ b/libavcodec/cabac.c
@@ -51,7 +51,7 @@ void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size){
*
* @param buf_size size of buf in bits
*/
-void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){
+int ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){
c->bytestream_start=
c->bytestream= buf;
c->bytestream_end= buf + buf_size;
@@ -64,6 +64,9 @@ void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){
#endif
c->low+= ((*c->bytestream++)<<2) + 2;
c->range= 0x1FE;
+ if ((c->range<<(CABAC_BITS+1)) < c->low)
+ return AVERROR_INVALIDDATA;
+ return 0;
}
void ff_init_cabac_states(void)