On 02/03/15 16:14, Andreas Cadhalpun wrote:
> 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 <[email protected]>
>>>> 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) {
> 

And it is as wrong, as I said above... (see what happens to mp4 to see
how it should be done).

Btw I eventually had time to test and Libav does not have the assert
problem, just happily produces a faulty file.

lu
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to