summaryrefslogtreecommitdiffstats
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka-at-google.com@ffmpeg.org>2017-08-20 11:56:47 -0700
committerMichael Niedermayer <michael@niedermayer.cc>2017-08-23 03:17:11 +0200
commiteca2a49716ae1f42804dd3545da2f740edf03250 (patch)
treeb726ee256d9fc9eed5f1abdd175d835d074d12ee /libavformat/aviobuf.c
parent4a404cb5b90b878cbe1bb528fac65cf508668cc5 (diff)
downloadffmpeg-streaming-eca2a49716ae1f42804dd3545da2f740edf03250.zip
ffmpeg-streaming-eca2a49716ae1f42804dd3545da2f740edf03250.tar.gz
avformat/aviobuf: Fix signed integer overflow in avio_seek()
Signed integer overflow is undefined behavior. Detected with clang and -fsanitize=signed-integer-overflow Signed-off-by: Vitaly Buka <vitalybuka@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 7f4e740..ec21fc7 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -259,6 +259,8 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
offset1 = pos + (s->buf_ptr - s->buffer);
if (offset == 0)
return offset1;
+ if (offset > INT64_MAX - offset1)
+ return AVERROR(EINVAL);
offset += offset1;
}
if (offset < 0)
OpenPOWER on IntegriCloud