1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavf/ftp: fix seek to nagative position

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
This commit is contained in:
Lukasz Marek 2014-02-28 00:07:31 +01:00
parent 0025f13005
commit 9f4b55ef49

View File

@ -575,10 +575,12 @@ static int64_t ftp_seek(URLContext *h, int64_t pos, int whence)
if (h->is_streamed)
return AVERROR(EIO);
/* XXX: Simulate behaviour of lseek in file protocol, which could be treated as a reference */
new_pos = FFMAX(0, new_pos);
fake_pos = s->filesize != -1 ? FFMIN(new_pos, s->filesize) : new_pos;
if (new_pos < 0) {
av_log(h, AV_LOG_ERROR, "Seeking to nagative position.\n");
return AVERROR(EINVAL);
}
fake_pos = s->filesize != -1 ? FFMIN(new_pos, s->filesize) : new_pos;
if (fake_pos != s->position) {
if ((err = ftp_abort(h)) < 0)
return err;