Sox hangs when the rate effect causes the number of samples to go past 2^31. To reproduce:
Sox -V -S -r 48000 -b 24 -n -n synth 3:10:00 pinknoise rate 96000 rate 192000
I located the problem in rate_flush function in rate.c. The 'size_t remaining' variable is cast improperly to (int), which doesn't work at the 2^31 boundary for integers. To fix, simply change the if statement from:
if ((int)remaining > 0) {
to
if(samples_out > p->samples_out) {
Here is a patch file with the fix:
diff -cr sox-14.4.0/src/rate.c sox-14.4.0/src-update/rate.c
*** sox-14.4.0/src/rate.c Tue Dec 27 22:15:32 2011
--- sox-14.4.0/src-update/rate.c Tue Dec 4 11:04:47 2012
***************
*** 397,403 ****
size_t remaining = samples_out - p->samples_out;
sample_t * buff = calloc(1024, sizeof(*buff));
! if ((int)remaining > 0) {
while ((size_t)fifo_occupancy(fifo) < remaining) {
rate_input(p, buff, (size_t) 1024);
rate_process(p);
--- 397,403 ----
size_t remaining = samples_out - p->samples_out;
sample_t * buff = calloc(1024, sizeof(*buff));
! if (samples_out > p->samples_out) {
while ((size_t)fifo_occupancy(fifo) < remaining) {
rate_input(p, buff, (size_t) 1024);
rate_process(p);
Sincerely,
MrMod
Now in git. Good catch—thanks!
Now fixed in dot, too.