[FFmpeg-devel] Possible minor bug found in AVI decoder

Tobias Rapp t.rapp at noa-archive.com
Fri May 12 14:00:41 EEST 2017


On 12.05.2017 11:33, Eric Beuque wrote:
> Hi,
>
> i'm not really sure but i think a found a bug in the avi decoder of
> avformat.
>
> In the following function of the avidec.c:
>
> static int avi_read_header(AVFormatContext *s)
> {
>     ...
>         switch (tag) {
>             ...
>         case MKTAG('s', 't', 'r', 'f'):
>             /* stream header */
>             if (!size)
>                 break;
>             if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) {
>                 avio_skip(pb, size);
>             } else {
>                 ...
>                 switch (codec_type) {
>                 ...
>                 default:
>                     st->codec->codec_type = AVMEDIA_TYPE_DATA;
>                     st->codec->codec_id   = AV_CODEC_ID_NONE;
>                     st->codec->codec_tag  = 0;
>                     avio_skip(pb, size);
>                     break;
>                 }
>             }
>             break;
>         ...
> }
>
> If the codec_type is AVMEDIA_TYPE_DATA, but the format is empty (size=0)
> (which i think is allowed), then the codec_id is not set to
> AV_CODEC_ID_NONE.
>
> This will generate a trace when calling the avformat_find_stream_info:
> "Could not find codec parameters for stream 1 (Unknown: none): unknown codec
> Consider increasing the value for the 'analyzeduration' and 'probesize'
> options"
>
> I'm not really sure about he AVI spec if the format is mandatory or not,
> but i think there is a bug.

According to the document at 
https://msdn.microsoft.com/en-us/library/windows/desktop/dd318189(v=vs.85).aspx 
the "strf" chunk is mandatory but the data is only specified for 
audio/video streams so indeed it might be possible that a chunk size of 
0 occurs for generic data streams.

Regards,
Tobias



More information about the ffmpeg-devel mailing list