libebur128 icon indicating copy to clipboard operation
libebur128 copied to clipboard

Out of memory in ebur128_set_max_window in 1.2.6

Open GeorgA opened this issue 8 months ago • 0 comments

Hi, I'm not sure if I'm using the calls correctly, but for a 10s window LUFS value in EBUR128_MODE_I , I've used

ebur128_set_max_window(ectx, 10000)

In 1.2.4 this resulted in st->d->audio_data_frames = st->samplerate * st->d->window / 1000 and it runs fine.

In 1.2.6 it seems that the /1000 is omitted: safe_size_mul(st->samplerate, window, &new_audio_data_frames) which gives an insanely big malloc() and runs subsequently in the out of memory killer :(

Simple test:

#include <unistd.h>
#include <ebur128.h>

#define SRATE 48000
#define LUFS_WINDOW 10000

int main(int argc, char **argv) {
    ebur128_state* ectx;

    ectx=ebur128_init(2, SRATE, EBUR128_MODE_I|EBUR128_MODE_LRA);

    ebur128_set_max_window(ectx, LUFS_WINDOW);

    sleep(100);
}

GeorgA avatar Jun 27 '24 17:06 GeorgA