changeset 5085:878651429ae5 libavformat

Avoid divisions by 0 in the ASF demuxer if packet_size is not valid.
author reimar
date Fri, 03 Jul 2009 11:18:07 +0000
parents c64438359260
children 5e6156776ee2
files asfdec.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/asfdec.c	Thu Jul 02 12:47:58 2009 +0000
+++ b/asfdec.c	Fri Jul 03 11:18:07 2009 +0000
@@ -595,6 +595,9 @@
     int rsize = 8;
     int c, d, e, off;
 
+    // if we do not know packet size, allow skipping up to 32 kB
+    off= 32768;
+    if (s->packet_size > 0)
     off= (url_ftell(pb) - s->data_offset) % s->packet_size + 3;
 
     c=d=e=-1;
@@ -989,6 +992,7 @@
         start_pos[i]= pos;
     }
 
+    if (s->packet_size > 0)
     pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset;
     *ppos= pos;
     url_fseek(s->pb, pos, SEEK_SET);