diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-04-07 15:55:19 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-04-07 19:58:59 +0200 |
commit | d3b0fb10485423dccd748ee13796add27664bcf3 (patch) | |
tree | 86a5f78e5d9cfdc8f1ff915d16caf2016a0aae40 | |
parent | e80ce4adeab179d0c4f7cb6a6e9f0efb3a631e6e (diff) | |
download | ffmpeg-d3b0fb10485423dccd748ee13796add27664bcf3.tar.gz |
put_bits: add av_assert2() to check out of array writes.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/put_bits.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h index 132d1331e9..f8046b1d09 100644 --- a/libavcodec/put_bits.h +++ b/libavcodec/put_bits.h @@ -142,6 +142,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) #ifdef BITSTREAM_WRITER_LE bit_buf |= value << (32 - bit_left); if (n >= bit_left) { + av_assert2(s->buf_ptr+3<s->buf_end); AV_WL32(s->buf_ptr, bit_buf); s->buf_ptr+=4; bit_buf = (bit_left==32)?0:value >> bit_left; @@ -155,6 +156,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) } else { bit_buf<<=bit_left; bit_buf |= value >> (n - bit_left); + av_assert2(s->buf_ptr+3<s->buf_end); AV_WB32(s->buf_ptr, bit_buf); //printf("bitbuf = %08x\n", bit_buf); s->buf_ptr+=4; |