1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-14 22:22:59 +02:00

Avoid divisions by 0 in the ASF demuxer if packet_size is not valid.

r19330 by reimar


Originally committed as revision 22080 to svn://svn.ffmpeg.org/ffmpeg/branches/0.5
This commit is contained in:
Reinhard Tartler 2010-02-26 15:49:52 +00:00
parent 8e2149d7df
commit a317cd5722

View File

@ -555,7 +555,9 @@ int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
int rsize = 8; int rsize = 8;
int c, d, e, off; int c, d, e, off;
off= (url_ftell(pb) - s->data_offset) % asf->packet_size + 3; off= 32768;
if (s->packet_size > 0)
off= (url_ftell(pb) - s->data_offset) % asf->packet_size + 3;
c=d=e=-1; c=d=e=-1;
while(off-- > 0){ while(off-- > 0){
@ -941,7 +943,8 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
start_pos[i]= pos; start_pos[i]= pos;
} }
pos= (pos+asf->packet_size-1-s->data_offset)/asf->packet_size*asf->packet_size+ s->data_offset; if (s->packet_size > 0)
pos= (pos+asf->packet_size-1-s->data_offset)/asf->packet_size*asf->packet_size+ s->data_offset;
*ppos= pos; *ppos= pos;
url_fseek(s->pb, pos, SEEK_SET); url_fseek(s->pb, pos, SEEK_SET);