[FFmpeg-cvslog] bytestream2_init: assert that buf_size is valid

Michael Niedermayer git at videolan.org
Fri Jun 21 01:07:45 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Jun 21 00:32:00 2013 +0200| [c17dd513e7f15ef074e435119db7895837e6283a] | committer: Michael Niedermayer

bytestream2_init: assert that buf_size is valid

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c17dd513e7f15ef074e435119db7895837e6283a
---

 libavcodec/bytestream.h |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/bytestream.h b/libavcodec/bytestream.h
index af7f75b..f245859 100644
--- a/libavcodec/bytestream.h
+++ b/libavcodec/bytestream.h
@@ -26,6 +26,7 @@
 #include <stdint.h>
 #include <string.h>
 
+#include "libavutil/avassert.h"
 #include "libavutil/common.h"
 #include "libavutil/intreadwrite.h"
 
@@ -131,6 +132,7 @@ static av_always_inline void bytestream2_init(GetByteContext *g,
                                               const uint8_t *buf,
                                               int buf_size)
 {
+    av_assert0(buf_size >= 0);
     g->buffer       = buf;
     g->buffer_start = buf;
     g->buffer_end   = buf + buf_size;
@@ -140,6 +142,7 @@ static av_always_inline void bytestream2_init_writer(PutByteContext *p,
                                                      uint8_t *buf,
                                                      int buf_size)
 {
+    av_assert0(buf_size >= 0);
     p->buffer       = buf;
     p->buffer_start = buf;
     p->buffer_end   = buf + buf_size;



More information about the ffmpeg-cvslog mailing list