opusfile segfaults in op_mem_read
==16136== Thread 1:
==16136== Invalid write of size 1
==16136== at 0x4C26597: memcpy (in /opt/valgrind/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16136== by 0x4094AD: op_mem_read (stream.c:114)
==16136== by 0x4029B2: op_get_data (opusfile.c:146)
==16136== by 0x402B7A: op_get_next_page (opusfile.c:203)
==16136== by 0x403626: op_fetch_headers (opusfile.c:569)
==16136== by 0x40593A: op_open1 (opusfile.c:1490)
==16136== by 0x405B44: op_test_callbacks (opusfile.c:1546)
==16136== by 0x405BD2: op_open_callbacks (opusfile.c:1560)
==16136== by 0x405C91: op_open_close_on_failure (opusfile.c:1580)
==16136== by 0x405D2A: op_open_memory (opusfile.c:1593)
==16136== by 0x4026B1: mainloop() (mainloop.cpp:9)
==16136== by 0x402649: main (main.cpp:99)
==16136== Address 0x60c5803 is not stack'd, malloc'd or (recently) free'd
==16136==
==16136== Invalid write of size 8
==16136== at 0x4C265B1: memcpy (in /opt/valgrind/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16136== by 0x4094AD: op_mem_read (stream.c:114)
==16136== by 0x4029B2: op_get_data (opusfile.c:146)
==16136== by 0x402B7A: op_get_next_page (opusfile.c:203)
==16136== by 0x403626: op_fetch_headers (opusfile.c:569)
==16136== by 0x40593A: op_open1 (opusfile.c:1490)
==16136== by 0x405B44: op_test_callbacks (opusfile.c:1546)
==16136== by 0x405BD2: op_open_callbacks (opusfile.c:1560)
==16136== by 0x405C91: op_open_close_on_failure (opusfile.c:1580)
==16136== by 0x405D2A: op_open_memory (opusfile.c:1593)
==16136== by 0x4026B1: mainloop() (mainloop.cpp:9)
==16136== by 0x402649: main (main.cpp:99)
==16136== Address 0x60c57f8 is not stack'd, malloc'd or (recently) free'd
Using opus 1.0.2, opusfile 0.2, and doing this:
// load file to RAM. The length parameter is confirmed correct.
OggOpusFile* op = op_open_memory(ptr, len, NULL);
I get a segfault. It seems to happen no matter what opus file I use, but attaching one file of silence that makes it happen here.