mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-17 04:54:55 +00:00
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>
This commit is contained in:
commit
e8e91a32e5
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user