Skip to content

Commit

Permalink
Fixed bug 2467 - bad memcpy in SDL_OpenAudio/open_audio_device/prepar…
Browse files Browse the repository at this point in the history
…e_audiospec chain

Rainer Deyke

If 'SDL_OpenAudio' is called with 'obtained == NULL', 'prepare_audiospec' performs a bad 'memcpy' with the destination and source pointing to the same block of memory.  The problem appears to be on in 'SDL_OpenAudio', which calls open_audio_device with 'obtained = desired' when 'obtained == NULL'.  'open_audio_device' cannot deal with 'desired' and 'obtained' pointing to the same block of memory but can deal with 'obtained == NULL'
  • Loading branch information
slouken committed Jun 24, 2014
1 parent 3344db4 commit cbafb15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/audio/SDL_audio.c
Expand Up @@ -1094,7 +1094,7 @@ SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained)
id = open_audio_device(NULL, 0, desired, obtained,
SDL_AUDIO_ALLOW_ANY_CHANGE, 1);
} else {
id = open_audio_device(NULL, 0, desired, desired, 0, 1);
id = open_audio_device(NULL, 0, desired, NULL, 0, 1);
}

SDL_assert((id == 0) || (id == 1));
Expand Down

0 comments on commit cbafb15

Please sign in to comment.