avutil/fifo: assert that theres enough data in the fifo on drain calls.
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Sep 2013 01:05:41 +0000 (03:05 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 3 Sep 2013 01:11:35 +0000 (03:11 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/fifo.c

index eb1c128..ca25bc5 100644 (file)
@@ -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;