Browse Source

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>
tags/n3.4
Vitaly Buka Michael Niedermayer 8 years ago
parent
commit
eca2a49716
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      libavformat/aviobuf.c

+ 2
- 0
libavformat/aviobuf.c View File

@@ -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)


Loading…
Cancel
Save