[FFmpeg-devel] [PATCH 4/4] avio: detect implicit truncation by assert in avio_w*

Michael Niedermayer michaelni at gmx.at
Mon Oct 15 16:07:34 CEST 2012


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 at gmx.at>
---
 libavformat/aviobuf.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 1010815..535c545 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);
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list