From 100554a37f479e1c1a9ab7a89d84f5424d6f491b Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 29 Jun 2008 10:06:19 +0000 Subject: [PATCH] Replace asserts by proper conditions to allow playback of some broken but still playable files. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27154 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_asf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libmpdemux/demux_asf.c b/libmpdemux/demux_asf.c index 7d5a164886..65741d3ab7 100644 --- a/libmpdemux/demux_asf.c +++ b/libmpdemux/demux_asf.c @@ -3,7 +3,6 @@ #include #include #include -#include #include "config.h" #include "mp_msg.h" @@ -501,8 +500,9 @@ static int demux_asf_fill_buffer(demuxer_t *demux, demux_stream_t *ds){ int len2=p[0]; p++; //printf(" group part: %d bytes\n",len2); - if(len2 > len - 1) break; // Not enough data - assert(len2 > 0 && len2 <= asf->packetsize); + if(len2 > len - 1 || len2 < 0) break; // Not enough data + if(len2 == 0) continue; + len2 = FFMIN(len2, asf->packetsize); demux_asf_read_packet(demux,p,len2,streamno,seq,x,duration,-1,keyframe); p+=len2; len-=len2+1; @@ -515,8 +515,9 @@ static int demux_asf_fill_buffer(demuxer_t *demux, demux_stream_t *ds){ default: // NO GROUPING: //printf("fragment offset: %d \n",sh->x); + if (len <= 0) break; if (!asf->asf_is_dvr_ms || asf->found_first_key_frame) { - assert(len > 0 && len <= asf->packetsize); + len = FFMIN(len, asf->packetsize); demux_asf_read_packet(demux,p,len,streamno,seq,time2,duration,x,keyframe); } p+=len;