|
From: Ryo O. <ry...@aq...> - 2013-01-30 08:52:31
|
Hi all,
It seems the compand effect option parser has a bug.
Bus error (or segfault) occurs at compand.c line 86:
around strtok() with sox-14.4.0.
for (i = 0, s = strtok(argv[0], ","); s != NULL; ++i) {
...
}
regards,
// --------------------------------
test code:
#include "sox.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
int main(int argc, char * argv[]){
static sox_format_t * in, * out;
sox_effects_chain_t * chain;
sox_effect_t * e;
char * args[10];
assert(argc == 3);
assert(sox_init() == SOX_SUCCESS);
assert(in = sox_open_read(argv[1], NULL, NULL, NULL));
assert(out = sox_open_write(argv[2], &in->signal, NULL, NULL, NULL, NULL));
chain = sox_create_effects_chain(&in->encoding, &out->encoding);
// input chain
e = sox_create_effect(sox_find_effect("input"));
args[0] = (char *)in;
assert(sox_effect_options(e, 1, args) == SOX_SUCCESS);
assert(sox_add_effect(chain, e, &in->signal, &in->signal) == SOX_SUCCESS);
free(e);
// compand
e = sox_create_effect(sox_find_effect("compand"));
args[0] = "0.02,0.2";
args[1] = "5:-60,-40,-10";
args[2] = "-5";
args[3] = "-90";
args[4] = "0";
assert(sox_effect_options(e, 5, args) == SOX_SUCCESS);
assert(sox_add_effect(chain, e, &in->signal, &in->signal) == SOX_SUCCESS);
free(e);
// output chain
e = sox_create_effect(sox_find_effect("output"));
args[0] = (char *)out, assert(sox_effect_options(e, 1, args) ==
SOX_SUCCESS);
assert(sox_add_effect(chain, e, &in->signal, &in->signal) == SOX_SUCCESS);
free(e);
sox_flow_effects(chain, NULL, NULL);
sox_delete_effects_chain(chain);
sox_close(out);
sox_close(in);
sox_quit();
return 0;
}
--
R.Okamoto <ry...@aq...>
|