[FFmpeg-devel] [PATCH 1/3] avformat/aviobuf: read till the very end of the IO buffer

Marton Balint cus at passwd.hu
Sun Sep 20 11:52:51 EEST 2020


There was an off-by-one error when checking if the IO buffer still has enough
space till the end.

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 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);
 
-- 
2.26.2



More information about the ffmpeg-devel mailing list