[FFmpeg-cvslog] avutil/fifo: assert that theres enough data in the fifo on drain calls.

Michael Niedermayer git at videolan.org
Tue Sep 3 03:29:09 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Sep  3 03:05:41 2013 +0200| [cc84f304026122713a215a42598ecc18160ca66d] | committer: Michael Niedermayer

avutil/fifo: assert that theres enough data in the fifo on drain calls.

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

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

 libavutil/fifo.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavutil/fifo.c b/libavutil/fifo.c
index eb1c128..ca25bc5 100644
--- a/libavutil/fifo.c
+++ b/libavutil/fifo.c
@@ -19,6 +19,8 @@
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
+#include "avassert.h"
 #include "common.h"
 #include "fifo.h"
 
@@ -144,6 +146,7 @@ int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size,
 /** Discard data from the FIFO. */
 void av_fifo_drain(AVFifoBuffer *f, int size)
 {
+    av_assert2(av_fifo_size(f) >= size);
     f->rptr += size;
     if (f->rptr >= f->end)
         f->rptr -= f->end - f->buffer;



More information about the ffmpeg-cvslog mailing list