]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/bitstream: Assert that there is enough space left in avpriv_copy_bits()
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 25 May 2015 01:48:45 +0000 (03:48 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 25 May 2015 03:14:02 +0000 (05:14 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/bitstream.c

index e18171f03933acac94491acd6603e396a1c6d5ac..20eae6b1bf18b960279af1126daf710d61188a6d 100644 (file)
@@ -70,6 +70,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));