aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-14 17:26:11 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-06-10 02:13:07 +0200
commit4e6706f851d388163a7cfe53529810ec8888d95d (patch)
tree9cda574f10887414e003dbedf430a352c582fa30
parent32d24c8c05a9e12bc71412831b2a430b7e3f66e2 (diff)
downloadffmpeg-4e6706f851d388163a7cfe53529810ec8888d95d.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.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 93a187b4aa..4c29baf5a7 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -217,6 +217,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 <= (s->buf_end - s->buffer)) {