aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-03-05 18:18:07 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-03-05 18:18:07 +0100
commite0f5f9267a8bc104ec3cefe03873dd2508c46650 (patch)
tree1f8a0a9cf7ccaad7bf613a88fa57bdf793f3d3b6
parent76019f5fed066f350fd8c9e55ec2c47ddb47f2a8 (diff)
downloadffmpeg-e0f5f9267a8bc104ec3cefe03873dd2508c46650.tar.gz
avformat/avienc: assert that bits_per_coded_sample is within the supported range (out of array access otherwise)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/avienc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 9bf755efba..0cfffb7af7 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);