ffmpeg | branch: release/3.1 | Vitaly Buka 
<vitalybuka-at-google....@ffmpeg.org> | Sun Aug 20 11:56:47 2017 -0700| 
[6622be010b09368f57bfd09715386a373d79066c] | committer: Michael Niedermayer

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 <vitalyb...@google.com>
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
(cherry picked from commit eca2a49716ae1f42804dd3545da2f740edf03250)
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6622be010b09368f57bfd09715386a373d79066c
---

 libavformat/aviobuf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 95793c92cd..2c56adb307 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -249,6 +249,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)

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to