avio: exit early in fill_buffer without read_packet
Fixes an invalid free() with ass in avi. The sample in bug 98 passes parts of AVPacket.data as buffer for the AVIOContext. Since the packet is quite large fill_buffer tries to reallocate the buffer before doing nothing. Fixes bug 98.
This commit is contained in:
parent
d209c27b09
commit
a2d1d21629
@ -565,6 +565,10 @@ static void fill_buffer(AVIOContext *s)
|
||||
int len= s->buffer_size - (dst - s->buffer);
|
||||
int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE;
|
||||
|
||||
/* can't fill the buffer without read_packet, just set EOF if appropiate */
|
||||
if (!s->read_packet && s->buf_ptr >= s->buf_end)
|
||||
s->eof_reached = 1;
|
||||
|
||||
/* no need to do anything if EOF already reached */
|
||||
if (s->eof_reached)
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user