From 8a34b85fa8ded31d9f0572f902c2bcbf3a2e0b74 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Mon, 15 Oct 2012 16:02:14 +0200
Subject: [PATCH] avio: detect implicit truncation by assert in avio_w*

This check is somewhat more lenient as would be ideal because we dont
know if the input is signed or unsigned

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 libavformat/aviobuf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 3748818ad50..906415dbac7 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -144,6 +144,7 @@ static void flush_buffer(AVIOContext *s)
 
 void avio_w8(AVIOContext *s, int b)
 {
+    av_assert2(b>=-128 && b<=255);
     *s->buf_ptr++ = b;
     if (s->buf_ptr >= s->buf_end)
         flush_buffer(s);
-- 
GitLab