[FFmpeg-devel] Check return of url_fseek in av_seek_frame_binary

Michael Niedermayer michaelni
Wed Dec 2 13:04:18 CET 2009


On Tue, Dec 01, 2009 at 06:07:48PM -0800, Sean Soria wrote:
> Calls to url_fseek should have their return value checked in
> av_seek_frame_binary, just as they do in av_seek_frame_generic.
> Otherwise, function may return success even though url_fseek reported
> failure.
> 
> --- libavformat/utils.c (revision 20697)
> +++ libavformat/utils.c (working copy)
> @@ -1311,6 +1311,7 @@ int av_seek_frame_binary(AVFormatContext *s, int s
>      int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit;
>      int64_t ts_min, ts_max, ts;
>      int index;
> +    int64_t ret;
>      AVStream *st;
> 
>      if (stream_index < 0)
> @@ -1363,7 +1364,8 @@ int av_seek_frame_binary(AVFormatContext *s, int s
>          return -1;
> 
>      /* do the seek */
> -    url_fseek(s->pb, pos, SEEK_SET);
> +    if ((ret = url_fseek(s->pb, pos, SEEK_SET)) < 0)
> +        return ret;
> 
>      av_update_cur_dts(s, st, ts);

ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091202/84721519/attachment.pgp>



More information about the ffmpeg-devel mailing list