[Ffmpeg-devel] Bug: wav decoder decodes garbage at end of file

Michael Niedermayer michaelni
Mon Jun 26 14:19:09 CEST 2006


On Mon, Jun 26, 2006 at 01:04:31PM +0200, Ulrich von Zadow wrote:
> Hi,
> it appears that there is a bug in ffmpeg's wav file decoder. The symptom is 
> that certain wav files appear to have audible garbage at the end. These are 
> files that have chunk(s) following the actual WAVE chunk that contain 
> additional (for our purposes, superfluous) information. According to the 
> spec, this is perfectly legal. When decoding these files, ffmpeg reads to 
> the end of the file and not to the end of the WAVE chunk, thus treating the 
> additional data as audio samples.
> If I read the ffmpeg code correctly, the chunk size is actually read and 
> returned in find_tag (wav.c, 266ff) but then thrown away by wav_read_header 
> (wav.c, 331ff). This value should be used in wav_read_packet to determine 
> whether to set a logical eof state, I think.
> I made a short attempt at writing a patch, but ran into too many ffmpeg 
> design questions to get very far. For starters, where should the chunk size 
> be stored?

something like WAVContext, though it seems our wav demuxer doesnt have one,
its private context size is 0, you will have to change that ...

> How should wav_read_packet set 'logical eof'? Some help would be 
> appreciated.

hmm, iam not aware of a difference between logical and physical eof
handling, but if you want, see avidec.c, mov.c and so on they all
tend to have other stuff at the end


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is

More information about the ffmpeg-devel mailing list