WAV File corruption causes local DoS - Folder with all of them


I've got a folder called 'Music', which contains all .WAV files.
All of those .WAV files contain no 'data' chunk marker on them.
So, when I play one of the songs, it givs this error: "Can't open file: Error in WAV file. No 'data' chunk marker", and skips onto the next song. Because the next song doesn't have it either, it gives the error again and skips onto the next. And again, and again.

It makes mocp unusable, and you can't even quit mocp. The only way to exit is to pkill mocp.. It also uses 150% CPU.

It just keeps flashing the error, and you can't do a single thing.

Given that WAV files require exactly one 'data' chunk (because that's where the audio samples are), what's the point of those files of yours?

Dealing with corrupt files is often problematic, and especially so when one's software is at the mercy of external libraries. If you're currently decoding via the FFmpeg/LibAV libraries, then they are known to go spectacularly wrong on occasions when everything's not perfect. Perhaps using the PreferredDecoders configuration option to select a different decoder might at least help to contain the problem, but they are still unlikely to be playable. It's just a question of the most acceptable way to fail.

However, I'd still be interested in taking a look at one of those corrupt WAV files to see if there's anything which can be done within MOC. Are you able to place them somewhere I can download them? Do not e-mail them!


The reason I have these 'files', is because they're actually music!!
I'm not sure how they've been corrupted, but they play in Banshee fine..

Here's the file - http://www.internot.info/docs/Fireball.wav
I got this .wav straight from an actual CD.

Using 'aplay Fireball.wav', it works fine, too.

When I said they contained no 'data' chunk, I only assumed that, because that's what the error says.
It is a kind of annoying bug, because I can't listen to Deep Purple in mocp!!


I have now downloaded the test file and here are my findings:

  • The file does have a data chunk.
  • The problem only occurs with the sndfile decoder.
  • The error is coming from the libsndfile library (version 1.0.25 in my case).
  • sndfile-info reports the same error.
  • The FFmpeg/LibAV decoder works fine.

I wanted to test with the latest libsndfile GIT HEAD, but it required Python to autoconf.sh so I could proceed no further.

I tried to find a similar bug on the libsndfile web site but it seemed to require me to subscribe to even look at the mail list archives. I also looked at libsndfile on GitHub but it only showed open bugs (of which none matched these symptoms). Similarly, a web search yielded nothing useful.

I was able to reproduce the loop you describe, but only with 'Repeat' turned on. I'm not sure quite how to remedy this at present, but accept that it's something which should be fixed if possible. I have a couple of ideas but any suggestions are welcome.

You should report this bug (including the output of sndfile-info) to the mailing list, and post a URL by which it can be tracked here.

Meanwhile, I'd suggest that you use the FFmpeg/LibAV decoder for WAV files if possible: PreferredDecoders+=wav(ffmpeg).

Filtering the files through SoX also renders it playable (though you may have to re-establish the tags): sox Fireball.wav Fireball-fixed.wav

Fixed here: https://github.com/erikd/libsndfile/commit/aae58847406cc6738858424fa9c4ab574eccc934

Thanks for the feedback, "MegaManSec". It's good to have a positive result from library maintainers for a change.

However, we still have the MOC problem that it triggered... and suggestions are still welcome.

Sadly, I don't have any suggestions. Just that once it gets to the end of a playlist, it gives a warning message and you can set it on/off.

Perhaps a counter? for i i++ 11>i ?

Also, playing the music still doesn't seem to work. But that's not on your end, I don't think. I may have messed up my install of snd.
EDIT: Yeah, was my installation. Works now :P

Edit v2: I should mention that when I mean 'it works', I mean running "sndfile-info" works fine.
Mocp still doesn't play the file

I would have interpretted "it works" slightly differently without your second edit. So what does MOC do now?

Still just


│[] (50513!) Can't open file: Error in WAV file. No 'data' chunk marker. "

(With sndfile)

Even when compiled with --without-sndfile , it still says the same thing.


│[] (74135!) Can't open file: Error in WAV file. No 'data' chunk marker. "

I was about to post a slightly more involved reply, but I'm now fairly sure you're not running the mocp you think you are. The one you are running is still using the unpatched version of libsndfile.


I've figured it out.

It seems that from my previous installation of libsndfile, it left some unwanted files..

With the removal of those files, and the recompilation of mocp, it is all working.

It even fixed - http://moc.daper.net/node/935 !

So, all due to a leftover file..

I'm unsure what you mean about not running the mocp I think I am.

I was doing: "./configure --without-sndfile && make && ./mocp"

The lack of a "make install" step was what I was referring to. MOC requires this in order to install the decoder libraries and without it mocp would have been picking up any such libraries leftover from a previous install. (There are two ways around this and I'm putting together some documentation on them.)

I don't see why wiping sndfile files alone would have remedied the volume problem you were experiencing, but it does confirm that the cause was external to MOC.

So just to clarify, what do you mean by "all working" on this occasion?

Oh, I see.. Well, I did use make install a few times, but I didn't include it in my above comment.
Hmm.. I think documentation is needed on the requirement of installation.
Some people(including me) just want to try it out by just running ./mocp from the source, without installing anything.

When I say "all working", I mean that
1. Mocp plays the 'corrupt'(?) audio files.
2. My volume is once again working as it should.

AKA.. It's all good to close this report, and the volume problem report.

Thanks for the awesome product :)



in the config file doesn't seem to help either. Not sure if I was supposed to use something else.. But just in case..!

By "doesn't seem to help" you mean MOC exhibits the same looping problem as it did with the unpatched sndfile? Which version of FFmpeg/LibAV are you running?

Yes, I mean that it does the same looping.

Here's my versions:

ffmpeg 0.8.9-4:0.8.9-0ubuntu0.12.04.1
libavutil 51. 22. 1 / 51. 22. 1
libavcodec 53. 35. 0 / 53. 35. 0
libavformat 53. 21. 1 / 53. 21. 1
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 15. 0 / 2. 15. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 52. 0. 0 / 52. 0. 0

Read my reply to tomas for more information.

Check the log to see if ffmpeg decoder really tries to open the .wav files. If not you could just delete sndfile plugin and see what happens.

The easiest way would be to convert those files to Flac...

Here's a bit of the log file for WITHOUT that line at the end of my config file:

And here's from with the line at the end of my config file:


Here's the log file WITHOUT sndfile plugin installed(But still using the same complied program):

Even with sndfile uninstalled, and the use of --without-sndfile on compile, it gives the same error. http://pastebin.com/VmVBgrfP

An update...
$ sndfile-play Fireball.wav
Playing Fireball.wav

So, running sndfile-play works fine(And it actually comes out of my speakers).

But mocp doesn't.

Should I be doing something I'm not?