summaryrefslogtreecommitdiff
path: root/libavformat/ftp.c
diff options
context:
space:
mode:
authorLukasz Marek <lukasz.m.luki@gmail.com>2014-02-28 00:07:31 +0100
committerLukasz Marek <lukasz.m.luki@gmail.com>2014-02-28 00:07:31 +0100
commit9f4b55ef49c1525080507f5eaeef91091d243e16 (patch)
treed0b067cf41164736cb6e2310057c476e9a5c3053 /libavformat/ftp.c
parent0025f130059dedea3dcae7bc38fdf46c40097f4c (diff)
lavf/ftp: fix seek to nagative position
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Diffstat (limited to 'libavformat/ftp.c')
-rw-r--r--libavformat/ftp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 40a6a33c32..dae8aa086d 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -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;