Commit eca2a497 authored by Vitaly Buka's avatar Vitaly Buka Committed by 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: 's avatarVitaly Buka <vitalybuka@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 4a404cb5
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment