[FFmpeg-devel] Check return of url_fseek in av_seek_frame_binary

Sean Soria sean.soria
Wed Dec 2 03:07:48 CET 2009


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);
-------------- next part --------------
LS0tIGxpYmF2Zm9ybWF0L3V0aWxzLmMgKHJldmlzaW9uIDIwNjk3KQorKysgbGli
YXZmb3JtYXQvdXRpbHMuYyAod29ya2luZyBjb3B5KQpAQCAtMTMxMSw2ICsxMzEx
LDcgQEAgaW50IGF2X3NlZWtfZnJhbWVfYmluYXJ5KEFWRm9ybWF0Q29udGV4dCAq
cywgaW50IHMKICAgICBpbnQ2NF90IGF2X3VuaW5pdChwb3NfbWluKSwgYXZfdW5p
bml0KHBvc19tYXgpLCBwb3MsIHBvc19saW1pdDsKICAgICBpbnQ2NF90IHRzX21p
biwgdHNfbWF4LCB0czsKICAgICBpbnQgaW5kZXg7CisgICAgaW50NjRfdCByZXQ7
CiAgICAgQVZTdHJlYW0gKnN0OwogCiAgICAgaWYgKHN0cmVhbV9pbmRleCA8IDAp
CkBAIC0xMzYzLDcgKzEzNjQsOCBAQCBpbnQgYXZfc2Vla19mcmFtZV9iaW5hcnko
QVZGb3JtYXRDb250ZXh0ICpzLCBpbnQgcwogICAgICAgICByZXR1cm4gLTE7CiAK
ICAgICAvKiBkbyB0aGUgc2VlayAqLwotICAgIHVybF9mc2VlayhzLT5wYiwgcG9z
LCBTRUVLX1NFVCk7CisgICAgaWYgKChyZXQgPSB1cmxfZnNlZWsocy0+cGIsIHBv
cywgU0VFS19TRVQpKSA8IDApCisgICAgICAgIHJldHVybiByZXQ7CiAKICAgICBh
dl91cGRhdGVfY3VyX2R0cyhzLCBzdCwgdHMpOwogCg==



More information about the ffmpeg-devel mailing list