AudioFormatReader: Check if audio file is corrupt?

When trying to open a .wav file a friend sent me I saw that my AudioFormatReader::read() method was entering into some kind of endless loop and the UI becomes non-responsive. In the end, we figured the it must be the audio file, even though it loads fine an all editors we tried. We ran it through SOX, and it returned the following warning:

sox WARN wav: Premature EOF on .wav input file

Any idea how I might catch something like that so we can guard against it in the future?