[FFmpeg-cvslog] avformat/avienc: assert that bits_per_coded_sample is within the supported range ( out of array access otherwise)

Michael Niedermayer git at videolan.org
Sat Mar 5 18:43:53 CET 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Mar  5 18:18:07 2016 +0100| [e0f5f9267a8bc104ec3cefe03873dd2508c46650] | committer: Michael Niedermayer

avformat/avienc: assert that bits_per_coded_sample is within the supported range (out of array access otherwise)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/avienc.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 9bf755e..0cfffb7 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -699,6 +699,9 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
             if (ret2) {
                 int pal_size = 1 << enc->bits_per_coded_sample;
                 int pc_tag, i;
+
+                av_assert0(enc->bits_per_coded_sample >= 0 && enc->bits_per_coded_sample <= 8);
+
                 if (pb->seekable && avist->pal_offset) {
                     int64_t cur_offset = avio_tell(pb);
                     avio_seek(pb, avist->pal_offset, SEEK_SET);



More information about the ffmpeg-cvslog mailing list