Mercurial > mplayer.hg
comparison libmpdemux/demux_avi.c @ 17366:934380353fd6
massive attack: mp_msg printf format fixes
author | rathann |
---|---|
date | Thu, 12 Jan 2006 20:04:36 +0000 |
parents | adb64d908347 |
children | 67c30d47ffd4 |
comparison
equal
deleted
inserted
replaced
17365:e2ca21ac42ce | 17366:934380353fd6 |
---|---|
219 continue; // skip this chunk | 219 continue; // skip this chunk |
220 } | 220 } |
221 | 221 |
222 pos = (off_t)priv->idx_offset+AVI_IDX_OFFSET(idx); | 222 pos = (off_t)priv->idx_offset+AVI_IDX_OFFSET(idx); |
223 if((pos<demux->movi_start || pos>=demux->movi_end) && (demux->movi_end>demux->movi_start) && (demux->stream->flags & STREAM_SEEK)){ | 223 if((pos<demux->movi_start || pos>=demux->movi_end) && (demux->movi_end>demux->movi_start) && (demux->stream->flags & STREAM_SEEK)){ |
224 mp_msg(MSGT_DEMUX,MSGL_V,"ChunkOffset out of range! idx=0x%X \n",pos); | 224 mp_msg(MSGT_DEMUX,MSGL_V,"ChunkOffset out of range! idx=0x%"PRIX64" \n",(int64_t)pos); |
225 continue; | 225 continue; |
226 } | 226 } |
227 #if 0 | 227 #if 0 |
228 if(pos!=demux->filepos){ | 228 if(pos!=demux->filepos){ |
229 mp_msg(MSGT_DEMUX,MSGL_V,"Warning! pos=0x%X idx.pos=0x%X diff=%d \n",demux->filepos,pos,pos-demux->filepos); | 229 mp_msg(MSGT_DEMUX,MSGL_V,"Warning! pos=0x%X idx.pos=0x%X diff=%d \n",demux->filepos,pos,pos-demux->filepos); |
243 } | 243 } |
244 len=stream_read_dword_le(demux->stream); | 244 len=stream_read_dword_le(demux->stream); |
245 // if((len&(~1))!=(idx->dwChunkLength&(~1))){ | 245 // if((len&(~1))!=(idx->dwChunkLength&(~1))){ |
246 // if((len)!=(idx->dwChunkLength)){ | 246 // if((len)!=(idx->dwChunkLength)){ |
247 if((len!=idx->dwChunkLength)&&((len+1)!=idx->dwChunkLength)){ | 247 if((len!=idx->dwChunkLength)&&((len+1)!=idx->dwChunkLength)){ |
248 mp_msg(MSGT_DEMUX,MSGL_V,"ChunkSize mismatch! raw=%d idx=%ld \n",len,idx->dwChunkLength); | 248 mp_msg(MSGT_DEMUX,MSGL_V,"ChunkSize mismatch! raw=%d idx=%d \n",len,idx->dwChunkLength); |
249 if(len>0x200000 && idx->dwChunkLength>0x200000) continue; // both values bad :( | 249 if(len>0x200000 && idx->dwChunkLength>0x200000) continue; // both values bad :( |
250 len=choose_chunk_len(idx->dwChunkLength,len); | 250 len=choose_chunk_len(idx->dwChunkLength,len); |
251 } | 251 } |
252 if(!(idx->dwFlags&AVIIF_KEYFRAME)) flags=0; | 252 if(!(idx->dwFlags&AVIIF_KEYFRAME)) flags=0; |
253 } else { | 253 } else { |
333 continue; // skip this chunk | 333 continue; // skip this chunk |
334 } | 334 } |
335 | 335 |
336 pos = priv->idx_offset+AVI_IDX_OFFSET(idx); | 336 pos = priv->idx_offset+AVI_IDX_OFFSET(idx); |
337 if((pos<demux->movi_start || pos>=demux->movi_end) && (demux->movi_end>demux->movi_start)){ | 337 if((pos<demux->movi_start || pos>=demux->movi_end) && (demux->movi_end>demux->movi_start)){ |
338 mp_msg(MSGT_DEMUX,MSGL_V,"ChunkOffset out of range! current=0x%X idx=0x%X \n",demux->filepos,pos); | 338 mp_msg(MSGT_DEMUX,MSGL_V,"ChunkOffset out of range! current=0x%"PRIX64" idx=0x%"PRIX64" \n",(int64_t)demux->filepos,(int64_t)pos); |
339 continue; | 339 continue; |
340 } | 340 } |
341 #if 0 | 341 #if 0 |
342 if(pos!=demux->filepos){ | 342 if(pos!=demux->filepos){ |
343 mp_msg(MSGT_DEMUX,MSGL_V,"Warning! pos=0x%X idx.pos=0x%X diff=%d \n",demux->filepos,pos,pos-demux->filepos); | 343 mp_msg(MSGT_DEMUX,MSGL_V,"Warning! pos=0x%X idx.pos=0x%X diff=%d \n",demux->filepos,pos,pos-demux->filepos); |
356 else | 356 else |
357 if(!valid_fourcc(id)) continue; // drop chunk if both id and idx bad | 357 if(!valid_fourcc(id)) continue; // drop chunk if both id and idx bad |
358 } | 358 } |
359 len=stream_read_dword_le(demux->stream); | 359 len=stream_read_dword_le(demux->stream); |
360 if((len!=idx->dwChunkLength)&&((len+1)!=idx->dwChunkLength)){ | 360 if((len!=idx->dwChunkLength)&&((len+1)!=idx->dwChunkLength)){ |
361 mp_msg(MSGT_DEMUX,MSGL_V,"ChunkSize mismatch! raw=%d idx=%ld \n",len,idx->dwChunkLength); | 361 mp_msg(MSGT_DEMUX,MSGL_V,"ChunkSize mismatch! raw=%d idx=%d \n",len,idx->dwChunkLength); |
362 if(len>0x200000 && idx->dwChunkLength>0x200000) continue; // both values bad :( | 362 if(len>0x200000 && idx->dwChunkLength>0x200000) continue; // both values bad :( |
363 len=choose_chunk_len(idx->dwChunkLength,len); | 363 len=choose_chunk_len(idx->dwChunkLength,len); |
364 } | 364 } |
365 if(!(idx->dwFlags&AVIIF_KEYFRAME)) flags=0; | 365 if(!(idx->dwFlags&AVIIF_KEYFRAME)) flags=0; |
366 } else return 0; | 366 } else return 0; |
580 else if(sh_audio && sh_audio->ds->id == id) { | 580 else if(sh_audio && sh_audio->ds->id == id) { |
581 asize+=len; | 581 asize+=len; |
582 asamples+=(len+priv->audio_block_size-1)/priv->audio_block_size; | 582 asamples+=(len+priv->audio_block_size-1)/priv->audio_block_size; |
583 } | 583 } |
584 } | 584 } |
585 mp_msg(MSGT_DEMUX,MSGL_V,"AVI video size=%lu (%lu) audio size=%lu (%lu)\n",vsize,vsamples,asize,asamples); | 585 mp_msg(MSGT_DEMUX,MSGL_V,"AVI video size=%u (%u) audio size=%u (%u)\n",vsize,vsamples,asize,asamples); |
586 priv->numberofframes=vsamples; | 586 priv->numberofframes=vsamples; |
587 sh_video->i_bps=((float)vsize/(float)vsamples)*(float)sh_video->video.dwRate/(float)sh_video->video.dwScale; | 587 sh_video->i_bps=((float)vsize/(float)vsamples)*(float)sh_video->video.dwRate/(float)sh_video->video.dwScale; |
588 if(sh_audio) sh_audio->i_bps=((float)asize/(float)asamples)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale; | 588 if(sh_audio) sh_audio->i_bps=((float)asize/(float)asamples)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale; |
589 } else { | 589 } else { |
590 // guessing, results may be inaccurate: | 590 // guessing, results may be inaccurate: |
607 asize=sh_audio->audio.dwLength; | 607 asize=sh_audio->audio.dwLength; |
608 sh_audio->i_bps=(float)asize/(sh_video->frametime*priv->numberofframes); | 608 sh_audio->i_bps=(float)asize/(sh_video->frametime*priv->numberofframes); |
609 } | 609 } |
610 } | 610 } |
611 vsize=demuxer->movi_end-demuxer->movi_start-asize-8*priv->numberofframes; | 611 vsize=demuxer->movi_end-demuxer->movi_start-asize-8*priv->numberofframes; |
612 mp_msg(MSGT_DEMUX,MSGL_V,"AVI video size=%lu (%lu) audio size=%lu\n",vsize,priv->numberofframes,asize); | 612 mp_msg(MSGT_DEMUX,MSGL_V,"AVI video size=%d (%u) audio size=%d\n",vsize,priv->numberofframes,asize); |
613 sh_video->i_bps=(float)vsize/(sh_video->frametime*priv->numberofframes); | 613 sh_video->i_bps=(float)vsize/(sh_video->frametime*priv->numberofframes); |
614 } | 614 } |
615 return demuxer; | 615 return demuxer; |
616 | 616 |
617 } | 617 } |