From 602dd8f6c4d4f7e1b5f48cc580fd9b694d41d602 Mon Sep 17 00:00:00 2001 From: Benoit Fouet Date: Wed, 26 Sep 2007 11:32:51 +0000 Subject: [PATCH] Check read_packet before using it. Originally committed as revision 10588 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/aviobuf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index e7d9a623c7..f156d95fe6 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -263,7 +263,7 @@ void put_tag(ByteIOContext *s, const char *tag) static void fill_buffer(ByteIOContext *s) { - int len; + int len=0; /* no need to do anything if EOF already reached */ if (s->eof_reached) @@ -275,6 +275,7 @@ static void fill_buffer(ByteIOContext *s) s->checksum_ptr= s->buffer; } + if(s->read_packet) len = s->read_packet(s->opaque, s->buffer, s->buffer_size); if (len <= 0) { /* do not modify buffer if EOF reached so that a seek back can @@ -341,6 +342,7 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size) len = size; if (len == 0) { if(size > s->buffer_size && !s->update_checksum){ + if(s->read_packet) len = s->read_packet(s->opaque, buf, size); if (len <= 0) { /* do not modify buffer if EOF reached so that a seek back can