Martin Guy <martinw...@gmail.com> writes: > On 5/20/24 15:27, Måns Rullgård wrote: >> Martin Guy <martinw...@gmail.com> writes: >>> I would post an issue and patch on sourceforge, but that seems useless as >>> the existing patches haven't been applied since 2006. >> You can send patches to this mailing list. > > Here. > > In general, though, sox's SF issue tracker seems to be ineffective, which > both impacts the quality and functionality of sox, but also discourages > well-intentioned people from contributing to it, as they start out > enthusiastic, follow what seem like the right steps, and then are ignored > for decades. I am one example of that. I've added log frequency axis to > sndfile-tools' sndfile-spectrogram and would have done the same for sox but > it seemed pointless after the FFTW patches being ignored for so long, making > me have to update them to stride code changes, until I eventually gave the > idea up as wasted work. > > There are contributions with patches from 2006, which may or may not be > useful these days. There are patch suggestions that give links to github > repos that have long since been deleted, but the pointless issue persists on > SF. > > This gives the public impression to developers is that it is abandonware or > only-us-not-you-ware. > > Could the project use some help, as I've been programming since I was 13 and > am now 60 and on a pension so I can choose what I work on, and resolving the > sox SF issues seems worth doing as it is an excellent tool that seems > neglected in that area. > > Cheers > > M > > Fix segmentation fault when -x argument is > number of samples in the file > > $ sox -c 1 -b 16 -r 1000 -n file.wav synth 1 sin 440 gain -3 > $ sox file.wav -n spectrogram -x 1001 > Segmentation fault (core dumped) > > #0 0xb7e77c29 in print_at_ (pixels=0xa5e630 "", cols=144, x=-2147483614, > y=24, c=1, text=0xbfe4b824 "Time (s)", orientation=0) at spectrogram.c:728 > 728 case 0: pixel(x + j, y - i) = c; break; > (gdb) frame 1 > #1 0xb7e78749 in stop (effp=0xa46410) at spectrogram.c:870 > 870 print_at(left + (p->cols - font_X * strlen(text)) / 2, 24, Text, > text); > > This happens because strlen(txt) is unsigned, making the whole bracket > expression unsigned and calculating 4294967248/2 instead of -48/2 > > diff --git a/src/spectrogram.c b/src/spectrogram.c > index 3dcda69c..c13eb6c9 100644 > --- a/src/spectrogram.c > +++ b/src/spectrogram.c > @@ -867,7 +867,7 @@ static int stop(sox_effect_t *effp) /* only called, by > end(), on flow 0 */ > /* X-axis */ > step = axis(secs(p->cols), p->cols / (font_X * 9 / 2), &limit, &prefix); > sprintf(text, "Time (%.1ss)", prefix); /* Axis label */ > - print_at(left + (p->cols - font_X * strlen(text)) / 2, 24, Text, text); > + print_at(left + (p->cols - font_X * (int)strlen(text)) / 2, 24, Text, > text); > > for (i = 0; i <= limit; i += step) { > int x = limit ? (double)i / limit * p->cols + .5 : 0;
There must be something else/additional going on, because on my system it segfaults with or without this patch. -- Måns Rullgård _______________________________________________ SoX-devel mailing list SoX-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-devel