david-pace / wave-recovery-tool

Tool to display WAVE/AIFF file header information and to restore corrupted WAVE/AIFF file headers
GNU General Public License v3.0
14 stars 2 forks source link

AIFF Analysis Fails with error('unpack requires a buffer of 4 bytes') #14

Closed david-pace closed 1 year ago

david-pace commented 1 year ago

This error occurred when analyzing a folder containing ~ 1300 AIFF files:

waverecovery.py: error('unpack requires a buffer of 4 bytes')
                 for help use --help
david-pace commented 1 year ago

Error happens in waveheaderprocessor.py, line 320:

chunk_size = struct.unpack(">I", chunk_size_bytes)[0]

The AIFF file contains a ResU chunk with a chunk size of 337. However, the file contains 338 bytes after that. So there is an additional zero byte at the end of the file which can not be read as chunk header (which always requires 8 bytes).