changeset 2576:df67ee47f76d libavformat

Check read_packet before using it.
author benoit
date Wed, 26 Sep 2007 11:32:51 +0000
parents 06d31789d338
children 8389e57c7c3a
files aviobuf.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/aviobuf.c	Tue Sep 25 20:58:37 2007 +0000
+++ b/aviobuf.c	Wed Sep 26 11:32:51 2007 +0000
@@ -263,7 +263,7 @@
 
 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 @@
         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 @@
             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