[FFmpeg-devel] [PATCH] [matroska] Check return value of avio_seek and avoid modifying state if it fails

Michael Niedermayer michaelni at gmx.at
Fri Sep 30 03:56:20 CEST 2011


a little late review as i hoped aurel would have time to review it


On Wed, Sep 14, 2011 at 10:21:27PM +0200, Joakim Plate wrote:
[...]
> @@ -2018,25 +2018,20 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
>      timestamp = FFMAX(timestamp, st->index_entries[0].timestamp);
>  
>      if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
> -        avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
> +        if (avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET) < 0)
> +            return -1;
>          matroska->current_id = 0;
>          while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
>              matroska_clear_queue(matroska);
>              if (matroska_parse_cluster(matroska) < 0)
>                  break;
>          }
> -    }
> -
> -    matroska_clear_queue(matroska);
> -    if (index < 0)
> +        matroska_clear_queue(matroska);
>          return 0;
> +    }

this doesnt look correct, index is updated in the while() and may be
>= 0 and this would skip the subtitle code below

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110930/22f791fb/attachment.asc>


More information about the ffmpeg-devel mailing list