After updating miniaudio (after years) to current master (0.11.9), and fixed the api breaks, I noticed that running an ubsan (with clang 8) build creates a bunch of errors about unaligned access (external file, because it's big).
miniaudio.log
Otherwise it works for me in amd64 debug build, but technically it's an undefined behavior and it might break with optimizations or on CPU architectures that doesn't support unaligned accesses.
After some digging around it looks like at line 49162 (inside ma_linear_resampler_get_heap_layout) before initializing LPF, pHeapLayout->sizeInBytes will be 4, but on 64 bit architectures it should be aligned to 8 bytes. Manually adding a pHeapLayout->sizeInBytes = ma_align_64(pHeapLayout->sizeInBytes); before fixes the problem for me and all ubsan warnings disappear.
After updating miniaudio (after years) to current master (0.11.9), and fixed the api breaks, I noticed that running an ubsan (with clang 8) build creates a bunch of errors about unaligned access (external file, because it's big). miniaudio.log Otherwise it works for me in amd64 debug build, but technically it's an undefined behavior and it might break with optimizations or on CPU architectures that doesn't support unaligned accesses.
After some digging around it looks like at line 49162 (inside
ma_linear_resampler_get_heap_layout
) before initializing LPF,pHeapLayout->sizeInBytes
will be 4, but on 64 bit architectures it should be aligned to 8 bytes. Manually adding apHeapLayout->sizeInBytes = ma_align_64(pHeapLayout->sizeInBytes);
before fixes the problem for me and all ubsan warnings disappear.