Hi,
I have a corrupt WAV file that triggers an infinite loop in sox when the --info command is used.
The command: .\sox-14.4.2\sox.exe --info -V -V '.\test-case.wav' produces this output:
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
C:\Temp\sox-14.4.2\sox.exe DBUG wav: WAV Chunk
And does not appear to stop repeating - I've left the command running for two days. The command should stop... in my own application I've added a timeout to the info command as an interim workaround.
Interestingly, without the verbose switches, the info command works fine and reports the stats for the (clearly corrupted) file:
C:\Temp> .\sox-14.4.2\sox.exe --info '.\test-case.wav'
Input File : '.\test-case.wav'
Channels : 1
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:00.00 = 22 samples = 0.037415 CDDA sectors
File Size : 158M
Bit Rate : 2.54T
Sample Encoding: 16-bit Signed Integer PCM
I've attached the file that causes this bug.
It does eventually finish, after printing that line 30 million times. This happens because the parser ends up scanning 150MB of zeros for a valid chunk. It's probably a good idea to simply abort instead.