Commit f88f1041a6 for ffmpeg
commit f88f1041a619aea745336557d1a9523233b45c61
Author: Xiujun Wang <xiujunwang.dev@gmail.com>
Date: Tue Sep 29 21:15:55 2026 +0800
avformat/hls: advance the init section read pointer
The init section is read through a fixed-size AVIO buffer. When it
needs more than one read, copying from the start again duplicates the
first chunk and corrupts the data that follows. Copy from the current
read offset instead.
Fixes: #24603
Signed-off-by: Xiujun Wang <xiujunwang.dev@gmail.com>
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 5c530215e0..38d2a99fb2 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1848,7 +1848,7 @@ restart:
if (v->init_sec_buf_read_offset < v->init_sec_data_len) {
/* Push init section out first before first actual segment */
int copy_size = FFMIN(v->init_sec_data_len - v->init_sec_buf_read_offset, buf_size);
- memcpy(buf, v->init_sec_buf, copy_size);
+ memcpy(buf, v->init_sec_buf + v->init_sec_buf_read_offset, copy_size);
v->init_sec_buf_read_offset += copy_size;
return copy_size;
}