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 <cus@passwd.hu>
pull/355/head
Marton Balint 4 years ago
parent 358c0bb168
commit 74c70efd12
  1. 2
      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);

Loading…
Cancel
Save