[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec bitstream.h,1.154,1.155

Michael Niedermayer CVS michael
Tue Sep 20 20:51:14 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv24538

Modified Files:
	bitstream.h 
Log Message:
precautionary checks


Index: bitstream.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/bitstream.h,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -d -r1.154 -r1.155
--- bitstream.h	18 Sep 2005 21:21:00 -0000	1.154
+++ bitstream.h	20 Sep 2005 18:51:12 -0000	1.155
@@ -53,6 +53,9 @@
 
 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 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;





More information about the ffmpeg-cvslog mailing list