mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-18 13:35:13 +00:00
aviobuf: Write new data at s->buf_end in fill_buffer
In most cases, s->buf_ptr will be equal to s->buf_end when fill_buffer is called, but this may not always be the case, if we're seeking forward by reading (permitted by the short seek threshold). If fill_buffer is writing to s->buf_ptr instead of s->buf_end (when they aren't equal and s->buf_ptr is ahead of s->buffer), the data between s->buf_ptr and s->buf_end is overwritten, leading to inconsistent buffer content. This could return incorrect data if later seeking back into the area before the current s->buf_ptr. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
06ed4873e6
commit
e360ada2d1
@ -468,7 +468,7 @@ void put_tag(AVIOContext *s, const char *tag)
|
||||
|
||||
static void fill_buffer(AVIOContext *s)
|
||||
{
|
||||
uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_ptr : s->buffer;
|
||||
uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_end : s->buffer;
|
||||
int len= s->buffer_size - (dst - s->buffer);
|
||||
int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user