diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-09-20 18:51:12 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-09-20 18:51:12 +0000 |
commit | 9061be9fb389c31e40b732e36b6ae311dbad552c (patch) | |
tree | 2c8d4a2836d38f719a986df493328c203309b89d | |
parent | 267e9dfa9dc5375949926edd6fe64ef1d5c56d56 (diff) | |
download | ffmpeg-9061be9fb389c31e40b732e36b6ae311dbad552c.tar.gz |
precautionary checks
Originally committed as revision 4602 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/bitstream.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/bitstream.h b/libavcodec/bitstream.h index 26dee2df88..9616d5f0fa 100644 --- a/libavcodec/bitstream.h +++ b/libavcodec/bitstream.h @@ -53,6 +53,9 @@ typedef struct PutBitContext { static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) { + if(buffer_size < 0) + buffer= buffer_size= 0; + s->buf = buffer; s->buf_end = s->buf + buffer_size; #ifdef ALT_BITSTREAM_WRITER @@ -672,7 +675,9 @@ static inline void skip_bits1(GetBitContext *s){ static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size) { - const int buffer_size= (bit_size+7)>>3; + int buffer_size= (bit_size+7)>>3; + if(buffer_size < 0 || bit_size < 0) + buffer= buffer_size= bit_size= 0; s->buffer= buffer; s->size_in_bits= bit_size; |