[FFmpeg-devel] [libav-devel] [PATCH] avformat/flvenc: check that the codec_tag fits in one byte
Andreas Cadhalpun
andreas.cadhalpun at googlemail.com
Mon Mar 2 16:14:16 CET 2015
On 01.03.2015 21:25, Luca Barbato wrote:
> On 01/03/15 21:22, Diego Biurrun wrote:
>> On Sat, Feb 28, 2015 at 09:12:57PM +0100, Andreas Cadhalpun wrote:
>>> From 850352d0e1c262b434094fb19787bbd5b6bf6c57 Mon Sep 17 00:00:00 2001
>>> From: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>>> Date: Sat, 28 Feb 2015 20:58:31 +0100
>>> Subject: [PATCH] avformat/flvenc: check that the codec_tag fits in one byte
>>>
>>> flags is later written with avio_w8 and if it doesn't fit in one byte it
>>> triggers an av_assert2.
>>>
>>> --- a/libavformat/flvenc.c
>>> +++ b/libavformat/flvenc.c
>>> @@ -537,7 +537,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 < -128 || flags > 255) {
>>> av_log(s, AV_LOG_ERROR,
>>> "Video codec '%s' is not compatible with FLV\n",
>>> avcodec_get_name(enc->codec_id));
>>
>> Maybe flags should be uint8_t instead?
>>
>
> No, the proper way is to blacklist/whitelist the supported codecs for flv.
It can be limited even further [1]:
- if (flags == 0) {
+ if (flags <= 0 || flags > 15) {
Best regards,
Andreas
1:
https://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=e8565d21c276ab9ac5ce785549420321fbd0b093
More information about the ffmpeg-devel
mailing list