Commit 602dd8f6 authored by Benoit Fouet's avatar Benoit Fouet

Check read_packet before using it.

Originally committed as revision 10588 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 0d2caa37
...@@ -263,7 +263,7 @@ void put_tag(ByteIOContext *s, const char *tag) ...@@ -263,7 +263,7 @@ void put_tag(ByteIOContext *s, const char *tag)
static void fill_buffer(ByteIOContext *s) static void fill_buffer(ByteIOContext *s)
{ {
int len; int len=0;
/* no need to do anything if EOF already reached */ /* no need to do anything if EOF already reached */
if (s->eof_reached) if (s->eof_reached)
...@@ -275,6 +275,7 @@ static void fill_buffer(ByteIOContext *s) ...@@ -275,6 +275,7 @@ static void fill_buffer(ByteIOContext *s)
s->checksum_ptr= s->buffer; s->checksum_ptr= s->buffer;
} }
if(s->read_packet)
len = s->read_packet(s->opaque, s->buffer, s->buffer_size); len = s->read_packet(s->opaque, s->buffer, s->buffer_size);
if (len <= 0) { if (len <= 0) {
/* do not modify buffer if EOF reached so that a seek back can /* 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) ...@@ -341,6 +342,7 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
len = size; len = size;
if (len == 0) { if (len == 0) {
if(size > s->buffer_size && !s->update_checksum){ if(size > s->buffer_size && !s->update_checksum){
if(s->read_packet)
len = s->read_packet(s->opaque, buf, size); len = s->read_packet(s->opaque, buf, size);
if (len <= 0) { if (len <= 0) {
/* do not modify buffer if EOF reached so that a seek back can /* do not modify buffer if EOF reached so that a seek back can
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment