Commit 9f4b55ef authored by Lukasz Marek's avatar Lukasz Marek

lavf/ftp: fix seek to nagative position

Signed-off-by: 's avatarLukasz Marek <lukasz.m.luki@gmail.com>
parent 0025f130
...@@ -575,10 +575,12 @@ static int64_t ftp_seek(URLContext *h, int64_t pos, int whence) ...@@ -575,10 +575,12 @@ static int64_t ftp_seek(URLContext *h, int64_t pos, int whence)
if (h->is_streamed) if (h->is_streamed)
return AVERROR(EIO); return AVERROR(EIO);
/* XXX: Simulate behaviour of lseek in file protocol, which could be treated as a reference */ if (new_pos < 0) {
new_pos = FFMAX(0, new_pos); av_log(h, AV_LOG_ERROR, "Seeking to nagative position.\n");
fake_pos = s->filesize != -1 ? FFMIN(new_pos, s->filesize) : new_pos; return AVERROR(EINVAL);
}
fake_pos = s->filesize != -1 ? FFMIN(new_pos, s->filesize) : new_pos;
if (fake_pos != s->position) { if (fake_pos != s->position) {
if ((err = ftp_abort(h)) < 0) if ((err = ftp_abort(h)) < 0)
return err; return err;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment