diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-14 17:26:11 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-01-06 18:28:33 +0100 |
commit | 0e9fe8510ec3113514758ec2d4cb1afdf3d3d0dc (patch) | |
tree | deca876182e7a8b7f57150c2343c54bdc6ac5d8c | |
parent | 1f59cfe65bc5f7e7787ca02cec37fa6f1d6f78dc (diff) | |
download | ffmpeg-0e9fe8510ec3113514758ec2d4cb1afdf3d3d0dc.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 8955825d87..baf7d600a6 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -220,6 +220,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) { |