]> git.sesse.net Git - ffmpeg/commitdiff
avformat/aviobuf: write data into the IO buffer till the very end of the buffer
authorMarton Balint <cus@passwd.hu>
Sun, 20 Sep 2020 07:32:44 +0000 (09:32 +0200)
committerMarton Balint <cus@passwd.hu>
Fri, 9 Oct 2020 19:07:18 +0000 (21:07 +0200)
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>
libavformat/aviobuf.c

index a77517d712116262ed53e961ad9100d025bdbc57..96754253497609c139a89960a560ce414346e58e 100644 (file)
@@ -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);