[FFmpeg-devel] [PATCH] asfdec: division by 0 on missing packet size

Reimar Döffinger Reimar.Doeffinger
Thu Jul 2 14:35:44 CEST 2009


Hello,
AFAICT there is no way to demux ASF without knowing the packet size,
thus read_header should already fail instead of crashing at read_packet
when we try to calulate modulus the packet size.
"Fixes" wmv7/smclockv7.wmv.1.0 from issue1240.
Index: libavformat/asfdec.c
===================================================================
--- libavformat/asfdec.c	(revision 19325)
+++ libavformat/asfdec.c	(working copy)
@@ -535,6 +535,10 @@
             url_fseek(pb, gsize - 24, SEEK_CUR);
         }
     }
+    if (s->packet_size <= 0) {
+        av_log(s, AV_LOG_FATAL, "Invalid packet size, can not demux!\n");
+        return -1;
+    }
     get_guid(pb, &g);
     get_le64(pb);
     get_byte(pb);



More information about the ffmpeg-devel mailing list