OSDN Git Service

avformat/flvenc: check that the codec_tag fits in the available bits
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Sat, 28 Feb 2015 19:58:31 +0000 (20:58 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 28 Feb 2015 22:00:55 +0000 (23:00 +0100)
flags is later written with avio_w8 and if it doesn't fit in one byte it
triggers an av_assert2.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/flvenc.c

index 95905a1..31f2371 100644 (file)
@@ -484,7 +484,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
         avio_w8(pb, FLV_TAG_TYPE_VIDEO);
 
         flags = enc->codec_tag;
-        if (flags == 0) {
+        if (flags <= 0 || flags > 15) {
             av_log(s, AV_LOG_ERROR,
                    "Video codec '%s' is not compatible with FLV\n",
                    avcodec_get_name(enc->codec_id));