diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-02-28 02:14:17 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-28 02:14:22 +0100 |
commit | e8e91a32e5ce3f7bc57634597684da8dcb334aec (patch) | |
tree | b60a45aa0a52d550f1753d3ecae161cef4d81f83 | |
parent | 5c634cbeb7b463e00ae2f2fa225a15b5b94c27be (diff) | |
parent | 9f4b55ef49c1525080507f5eaeef91091d243e16 (diff) | |
download | ffmpeg-e8e91a32e5ce3f7bc57634597684da8dcb334aec.tar.gz |
Merge remote-tracking branch 'lukaszmluki/master'
* lukaszmluki/master:
lavf/ftp: fix seek to nagative position
lavf/libssh: fix seek to nagative position
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/ftp.c | 8 | ||||
-rw-r--r-- | libavformat/libssh.c | 5 |
2 files changed, 10 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; diff --git a/libavformat/libssh.c b/libavformat/libssh.c index 418b100491..b20e93bbab 100644 --- a/libavformat/libssh.c +++ b/libavformat/libssh.c @@ -243,6 +243,11 @@ static int64_t libssh_seek(URLContext *h, int64_t pos, int whence) return AVERROR(EINVAL); } + if (newpos < 0) { + av_log(h, AV_LOG_ERROR, "Seeking to nagative position.\n"); + return AVERROR(EINVAL); + } + if (sftp_seek64(libssh->file, newpos)) { av_log(h, AV_LOG_ERROR, "Error during seeking.\n"); return AVERROR(EIO); |