mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
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> (cherry picked from commit eca2a49716ae1f42804dd3545da2f740edf03250) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
05fc22f9f6
commit
eaf231544f
@ -222,6 +222,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…
x
Reference in New Issue
Block a user