Dear Sir

As a software developer with ffmepg library, I found and fixed a bug in 
ffmepg's ASF file parser.
here the detail about this issue:
there is a netflix's test stream with some error data, ffmepg's file parser 
throw exception while parse head error stream.
So I add a condition to skip the error packet. The red section is my update's 
source code and test it ok. Please check it, many thanks.

diff -Nur asfdec.c asfdec_mod.c
--- asfdec.c    2011-05-12 22:15:20.000000000 +0800
+++ asfdec_mod.c        2011-06-01 09:00:25.000000000 +0800
@@ -906,6 +906,9 @@
             //printf("PacketLeftSize:%d  Pad:%d Pos:%"PRId64"\n", 
asf->packet_size_left, asf->packet_padsize, avio_tell(pb));
             assert(ret>=0);
             /* fail safe */
+                       if(ret >= s->packet_size)
+                               avio_skip(pb, s->packet_size);
+                       else
             avio_skip(pb, ret);

             asf->packet_pos= avio_tell(pb);
@@ -953,8 +956,8 @@
             //printf("COMPRESS size  %d  %d  %d   ms:%d\n", 
asf->packet_obj_size, asf->packet_frag_timestamp, asf->packet_size_left, 
asf->packet_multi_size);
         }
         if(   /*asf->packet_frag_size == asf->packet_obj_size*/
-              asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size
-           && asf_st->frag_offset + asf->packet_frag_size > 
asf->packet_obj_size){
+              (asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size
+           && asf_st->frag_offset + asf->packet_frag_size > 
asf->packet_obj_size)||asf->packet_obj_size <=0){
             av_log(s, AV_LOG_INFO, "ignoring invalid packet_obj_size (%d %d %d 
%d)\n",
                 asf_st->frag_offset, asf->packet_frag_size,
                 asf->packet_obj_size, asf_st->pkt.size);
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to