Description
Posted after a short conversation here.
With the windows x86 binaries downloaded from 2.30.0 release there's consistently occuring exception inside SDL_ConvertAudio, in case a AUDIO_S16 -> AUDIO_F32 conversion. Other conversions do not seem to cause this problem.
Noteably (and curiously) this exception does not occur if we build SDL2.dll ourselves from the same tag. Which makes me wonder if distributed binary is built with different compilation settings.
I noticed that shortly past 2.30.0 release there has been a commit that fixed a mistake in SDL_Convert_S16_to_F32_Scalar: 384fcea (see #8982).
But I am not able to tell if this is the same issue or some weird coincidence, because when running on my machine SDL2 normally selects SSE2 variants. Is there any way at all to know which settings the official SDL2.dll is built with, and/or which exactly functions are selected by SDL_BuildAudioCVT?
Minimal code example to reproduce this problem:
#include <stdint.h>
#include <string.h>
#include <SDL.h>
int main(int argc, char *argv[])
{
SDL_Init(0);
SDL_AudioCVT cvt;
uint8_t src[1024 * sizeof(float)];
memset(src, 0, sizeof(src));
SDL_BuildAudioCVT(&cvt,
AUDIO_S16SYS, 1, 44100,
AUDIO_F32SYS, 1, 44100);
cvt.buf = src;
cvt.len = sizeof(src) / cvt.len_mult;
SDL_ConvertAudio(&cvt);
return 0;
}
With these binaries this crashes as:
Exception thrown at 0x6C8B10D0 (SDL2.dll) in test_sdlaudioconv.exe: 0xC0000005: Access violation writing location 0x003C0D88.
Point of exception varies, and sometimes it gets past, but crashes on exit with "Stack around the variable 'cvt' was corrupted."