soxr icon indicating copy to clipboard operation
soxr copied to clipboard

Crash when realloc fails

Open TomArrow opened this issue 4 years ago • 1 comments

Here: https://github.com/chirlu/soxr/blob/master/src/vr32.c#L390

It appears that

dest = fifo_reserve(&s->fifo, len);

can return 0 if a realloc fails, but then

if (stage_num < 0) for (; i < len; ++src)
    dest[i++] = double_fir0(src), dest[i++] = double_fir1(src);

doesn't check if 0 was returned and then an access violation happens.

TomArrow avatar Nov 12 '21 16:11 TomArrow

In case it helps anyone, the likely cause of this failing is two threads using the same soxr_t handle at the same time without a mutex

Homer512 avatar Dec 30 '23 23:12 Homer512