summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-14 17:26:11 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-14 17:39:53 +0100
commited86dbd05d61363dc1c0d33f3267e2177c985fdd (patch)
tree89a187bc8e270d06ad08b59de3e4681618049c53 /libavformat/aviobuf.c
parent6de2f027cd60c99e1628baf5bb4aeea4b5008217 (diff)
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>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index f374314fba..0b0748e954 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -223,6 +223,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) {