xiph / speexdsp

Speex audio processing library - THIS IS A MIRROR, DEVELOPMENT HAPPENS AT https://gitlab.xiph.org/xiph/speexdsp
https://speex.org
Other
490 stars 191 forks source link

Fix a stack smashing bug #21

Closed romanbsd closed 5 years ago

romanbsd commented 5 years ago

If we have less than requested, the difference between that and available should be used.

tmatth commented 5 years ago

@romanbsd thanks for the patch, do you have a reproducer for this?

romanbsd commented 5 years ago
#include <speex/speex_buffer.h>

int main(void) {
    char data[1] = {'a'}, out[10];
    SpeexBuffer *buf = speex_buffer_init(100);
    speex_buffer_write(buf, data, 1);
    speex_buffer_read(buf, out, 10);
    speex_buffer_destroy(buf);
    return 0;
}
tmatth commented 5 years ago

Thanks, merged in https://github.com/xiph/speexdsp/commit/f9e43a12f4a1d85fdbca1eeffdce0f24e19dcfc7