[FFmpeg-cvslog] avformat/aviobuf: write data into the IO buffer till the very end of the buffer

Marton Balint git at videolan.org
Fri Oct 9 22:25:14 EEST 2020


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sun Sep 20 09:32:44 2020 +0200| [74c70efd12e6a603bc006bd11f7e7806e7c61aca] | committer: Marton Balint

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 at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74c70efd12e6a603bc006bd11f7e7806e7c61aca
---

 libavformat/aviobuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index a77517d712..9675425349 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);
 



More information about the ffmpeg-cvslog mailing list