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

Ulrich von Zadow coder
Mon Jun 26 13:04:31 CEST 2006


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? 
How should wav_read_packet set 'logical eof'? Some help would be appreciated.

If it helps, I can send a short wav file that shows the error when started with 
ffplay.

Cheers,

   Uli




More information about the ffmpeg-devel mailing list