[FFmpeg-user] mp3 duration is not correct

Nicolas George george at nsup.org
Thu Jul 17 17:58:03 CEST 2014


Le nonidi 29 messidor, an CCXXII, Oliver Fromme a écrit :
> The solution is rather simple:  The Xing header contains a
> field that holds the length of the file in bytes.  Just
> seek to that position and check if there's another header
> (instead of EOF that should normally be there).  If there
> is, then a concatenated file follows.  This procedure has
> to be repeated, in case that more than two files were
> concatenated.

That could be dangerous, a crafted file may trick lavf into reading much
more of the file than reasonable, leading to a possible DoS, especially if
the file is accessed by network. If someone implements it, this must be kept
in mind in order to avoid it.

A much easier (but also much less accurate, of course) solution would be to
compare the size in the Xing header and the size of the file reported by the
OS or protocol, and if they do not match, print a warning and/or extrapolate
the duration.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20140717/6f4602c1/attachment.asc>


More information about the ffmpeg-user mailing list