From: Marton Balint Date: Sun, 20 Sep 2020 07:32:44 +0000 (+0200) Subject: avformat/aviobuf: write data into the IO buffer till the very end of the buffer X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=74c70efd12e6a603bc006bd11f7e7806e7c61aca;p=ffmpeg avformat/aviobuf: write data into the IO buffer till the very end of the buffer There was an off-by-one error when checking if the IO buffer still has enough space till the end. One more byte can be safely written. Signed-off-by: Marton Balint --- diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index a77517d7121..96754253497 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -540,7 +540,7 @@ static void fill_buffer(AVIOContext *s) { int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE; - uint8_t *dst = s->buf_end - s->buffer + max_buffer_size < s->buffer_size ? + uint8_t *dst = s->buf_end - s->buffer + max_buffer_size <= s->buffer_size ? s->buf_end : s->buffer; int len = s->buffer_size - (dst - s->buffer);