[FFmpeg-cvslog] avcodec/bitstream: Assert that there is enough space left in avpriv_copy_bits()

Michael Niedermayer git at videolan.org
Mon Jul 20 10:48:11 CEST 2015


ffmpeg | branch: release/2.6 | Michael Niedermayer <michaelni at gmx.at> | Mon May 25 03:48:45 2015 +0200| [9e3723b848c14f001de4fec662b05b7d02c2d3bd] | committer: Michael Niedermayer

avcodec/bitstream: Assert that there is enough space left in avpriv_copy_bits()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 291ad5cc9cf815eb110b062487980fab2d107936)

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

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

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

diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 6e550ff..caf0317 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -69,6 +69,8 @@ void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
     if (length == 0)
         return;
 
+    av_assert0(length <= put_bits_left(pb));
+
     if (CONFIG_SMALL || words < 16 || put_bits_count(pb) & 7) {
         for (i = 0; i < words; i++)
             put_bits(pb, 16, AV_RB16(src + 2 * i));



More information about the ffmpeg-cvslog mailing list