Browse code

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

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

Michael Niedermayer authored on 2013/09/03 10:05:41
Showing 1 changed files
... ...
@@ -19,6 +19,8 @@
19 19
  * License along with FFmpeg; if not, write to the Free Software
20 20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 21
  */
22
+
23
+#include "avassert.h"
22 24
 #include "common.h"
23 25
 #include "fifo.h"
24 26
 
... ...
@@ -144,6 +146,7 @@ int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size,
144 144
 /** Discard data from the FIFO. */
145 145
 void av_fifo_drain(AVFifoBuffer *f, int size)
146 146
 {
147
+    av_assert2(av_fifo_size(f) >= size);
147 148
     f->rptr += size;
148 149
     if (f->rptr >= f->end)
149 150
         f->rptr -= f->end - f->buffer;