We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2467 - bad memcpy in SDL_OpenAudio/open_audio_device/prepare_audiospec chain
Summary: bad memcpy in SDL_OpenAudio/open_audio_device/prepare_audiospec chain
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-27 12:57 UTC by Rainer Deyke
Modified: 2014-06-24 08:41 UTC (History)
0 users

See Also:


Attachments
Fix to 'SDL_OpenAudio', as described in bug description. (640 bytes, patch)
2014-03-27 12:57 UTC, Rainer Deyke
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Deyke 2014-03-27 12:57:18 UTC
Created attachment 1599 [details]
Fix to 'SDL_OpenAudio', as described in bug description.

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', so my proposed fix is to simply remove the special handling of 'obtained == NULL' from 'SDL_OpenAudio'.
Comment 1 Sam Lantinga 2014-06-24 08:41:30 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/c9be8299ba6b