Prevent memory corruption in mcompand effect
Prevent memory corruption in mcompand effect

As demonstrated by valgrind, mcompand did overrun its input buffer if
a delay was specified for at least one of its sub-compands, since only
the number of emitted output samples was counted, not the number of
consumed input samples. Possible consequences include data corruption
and segmentation faults.

This commit takes over some code from src/compand.c that does proper
counting of input and output samples, and aborts processing when they
diverge (which should mean that a delay was specified).

It seems to make mcompand work with delays - especially a different
delay for each band - would require a major overhaul. The best
(long-term) solution might be to replace mcompand with an effect that
only splits its input into bands (each band is one channel), then
compand each channel individually in an effect of its own.
Long-term. :)

mhartzel/sox_personal_fork,cbagwell/sox,jacksonh/sox,Motiejus/sox,CaptainHayashi/sox,pcqpcq/sox,Motiejus/sox,pcqpcq/sox,Motiejus/sox,pcqpcq/sox,uklauer/sox,CaptainHayashi/sox,MageSlayer/sox,MageSlayer/sox,Distrotech/sox,mhartzel/sox_personal_fork,CaptainHayashi/sox,jacksonh/sox,cbagwell/sox,davel/sox,uklauer/sox,cbagwell/sox,mhartzel/sox_personal_fork,pcqpcq/sox,Motiejus/sox,cbagwell/sox,mhartzel/sox_personal_fork,Distrotech/sox,davel/sox,davel/sox,uklauer/sox,MageSlayer/sox,Distrotech/sox,MageSlayer/sox,Distrotech/sox,jacksonh/sox,uklauer/sox,jacksonh/sox,davel/sox,MageSlayer/sox,CaptainHayashi/sox