aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-03 03:05:41 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-03 03:11:35 +0200
commitcc84f304026122713a215a42598ecc18160ca66d (patch)
treec0fa05bf0aabdb9b4b89508320490d9ea1a48ded
parent3e36dc8626f4721ea749286dae40169ee5cb7d04 (diff)
downloadffmpeg-cc84f304026122713a215a42598ecc18160ca66d.tar.gz
avutil/fifo: assert that theres enough data in the fifo on drain calls.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavutil/fifo.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavutil/fifo.c b/libavutil/fifo.c
index eb1c128a3a..ca25bc5239 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;