diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-07-08 00:53:21 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-07-08 00:53:21 +0000 |
commit | bba833496586c7b44d1015f4b45b15b863aed476 (patch) | |
tree | f266d0102ab2c29279c18d8cf692b64a3bb9c46c /libavcodec/cabac.h | |
parent | 240ae82c51e1d798a93e201e5b34f3fade84f499 (diff) | |
download | ffmpeg-bba833496586c7b44d1015f4b45b15b863aed476.tar.gz |
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.h | 9 |
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; } |