[FFmpeg-cvslog] wavpackenc: assert on too small buffer

Christophe Gisquet git at videolan.org
Thu Aug 21 18:06:38 CEST 2014


ffmpeg | branch: master | Christophe Gisquet <christophe.gisquet at gmail.com> | Tue Aug 19 14:05:56 2014 +0200| [4a5cc34b46a8bf8d47ec907383be83b6153b9f69] | committer: Michael Niedermayer

wavpackenc: assert on too small buffer

bytestream2_* will not cause buffer overflow, but in that case, this means
the allocation would be incorrect and the encoded result invalid. Therefore,
assert no overflow occurred.

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a5cc34b46a8bf8d47ec907383be83b6153b9f69
---

 libavcodec/wavpackenc.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index 005cf7c..3631a08 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -2813,6 +2813,8 @@ static int wavpack_encode_block(WavPackEncodeContext *s,
     block_size = bytestream2_tell_p(&pb);
     AV_WL32(out + 4, block_size - 8);
 
+    av_assert0(put_bits_left(&s->pb) > 0);
+
     return block_size;
 }
 



More information about the ffmpeg-cvslog mailing list