summaryrefslogtreecommitdiff
path: root/libavcodec/cabac.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-07-08 00:53:21 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-07-08 00:53:21 +0000
commitbba833496586c7b44d1015f4b45b15b863aed476 (patch)
treef266d0102ab2c29279c18d8cf692b64a3bb9c46c /libavcodec/cabac.h
parent240ae82c51e1d798a93e201e5b34f3fade84f499 (diff)
overread fix
Originally committed as revision 3294 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/cabac.h')
-rw-r--r--libavcodec/cabac.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h
index 05c47363d2..21085b21e8 100644
--- a/libavcodec/cabac.h
+++ b/libavcodec/cabac.h
@@ -39,6 +39,7 @@ typedef struct CABACContext{
uint8_t mps_state[2*64]; ///< transIdxMPS
const uint8_t *bytestream_start;
const uint8_t *bytestream;
+ const uint8_t *bytestream_end;
int bits_left; ///<
PutBitContext pb;
}CABACContext;
@@ -253,7 +254,9 @@ static inline void renorm_cabac_decoder(CABACContext *c){
c->range+= c->range;
c->low+= c->low;
if(--c->bits_left == 0){
- c->low+= *c->bytestream++;
+ if(c->bytestream < c->bytestream_end)
+ c->low+= *c->bytestream;
+ c->bytestream++;
c->bits_left= 8;
}
}
@@ -298,7 +301,9 @@ static inline int get_cabac_bypass(CABACContext *c){
c->low += c->low;
if(--c->bits_left == 0){
- c->low+= *c->bytestream++;
+ if(c->bytestream < c->bytestream_end)
+ c->low+= *c->bytestream;
+ c->bytestream++;
c->bits_left= 8;
}