Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segfault in testaudio #10130

Closed
madebr opened this issue Jun 27, 2024 · 2 comments
Closed

segfault in testaudio #10130

madebr opened this issue Jun 27, 2024 · 2 comments
Assignees
Milestone

Comments

@madebr
Copy link
Contributor

madebr commented Jun 27, 2024

There's a segfault because SDL_GetAudioDeviceName(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK) returns NULL,
which is used as an argument to SDL_strdup.

return CreatePhysicalDeviceThing(recording ? SDL_AUDIO_DEVICE_DEFAULT_RECORDING : SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, recording);

static Thing *CreatePhysicalDeviceThing(const SDL_AudioDeviceID which, const SDL_bool recording)

thing->data.physdev.name = SDL_strdup(SDL_GetAudioDeviceName(which));

stacktrace:

__strlen_avx2 0x00007ffff7b7f8dd
SDL_strlen_REAL SDL_string.c:561
SDL_strdup_REAL SDL_string.c:855
SDL_strdup SDL_dynapi_procs.h:1020
CreatePhysicalDeviceThing testaudio.c:988
CreateDefaultPhysicalDevice testaudio.c:1016
SDL_AppInit testaudio.c:1100
SDL_InitMainCallbacks SDL_main_callbacks.c:99
SDL_EnterAppMainCallbacks_REAL SDL_sysmain_callbacks.c:42
SDL_EnterAppMainCallbacks SDL_dynapi_procs.h:171
SDL_main SDL_main_impl.h:59
SDL_RunApp_REAL SDL_runapp.c:40
SDL_RunApp_DEFAULT SDL_dynapi_procs.h:709
SDL_RunApp SDL_dynapi_procs.h:709
main SDL_main_impl.h:208
@icculus icculus self-assigned this Jun 27, 2024
@icculus icculus added this to the 3.2.0 milestone Jun 27, 2024
@icculus
Copy link
Collaborator

icculus commented Jun 27, 2024

Gosh, how long has this been broken?!

@icculus
Copy link
Collaborator

icculus commented Jun 27, 2024

Oh, only since e232573, where this used to handle NULL just fine and then I wrapped it in an SDL_strdup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants