mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/aviobuf: Check buf_size in ffio_ensure_seekback()
buffer_size is an int Fixes: signed integer overflow: 9223372036854775754 + 32767 cannot be represented in type 'long' Fixes: 45691/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5263458831040512 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
35dc93ab44
commit
c4b130e876
|
@ -1062,6 +1062,9 @@ int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
|
|||
if (buf_size <= s->buf_end - s->buf_ptr)
|
||||
return 0;
|
||||
|
||||
if (buf_size > INT_MAX - max_buffer_size)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
buf_size += max_buffer_size - 1;
|
||||
|
||||
if (buf_size + s->buf_ptr - s->buffer <= s->buffer_size || s->seekable || !s->read_packet)
|
||||
|
|
Loading…
Reference in New Issue