diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-14 17:26:11 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-20 02:25:54 +0100 |
commit | 0d277be45ae9bfbf4fb51408c3f3ef5b42296d66 (patch) | |
tree | 562b4f402c8e695741fcb9cbeb41c0f607c16937 | |
parent | 3b332ef33cecc71b74c6d12b1d0000a3733b788d (diff) | |
download | ffmpeg-0d277be45ae9bfbf4fb51408c3f3ef5b42296d66.tar.gz |
avformat/aviobuf: Check that avio_seek() target is non negative
Fixes out of array access
Suggested-by: Andrew Scherkus <scherkus@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ed86dbd05d61363dc1c0d33f3267e2177c985fdd)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/aviobuf.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index b1752cd234..d39b0c12eb 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -221,6 +221,9 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) return offset1; offset += offset1; } + if (offset < 0) + return AVERROR(EINVAL); + offset1 = offset - pos; if (!s->must_flush && (!s->direct || !s->seek) && offset1 >= 0 && offset1 <= buffer_size) { |