| Summary: | uninitialized wavespec used in SDL_BuildAudioCVT | ||
|---|---|---|---|
| Product: | SDL_mixer | Reporter: | Nitz <nitin.j4> |
| Component: | misc | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | ||
| Version: | 1.2.11 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
This has been fixed. |
In WAVStream *WAVStream_LoadSong_RW(SDL_RWops *src, int freesrc) function if( magic == RIFF || magic == WAVE ) and if( magic == FORM ) both conditions fails then wavespec remain uninitialized and used in SDL_BuildAudioCVT(&wave->cvt, wavespec.format, wavespec.channels, wavespec.freq, mixer.format, mixer.channels, mixer.freq); Which causes undefined behaviour. patch for this bug: if ( magic == RIFF || magic == WAVE ) { wave->src = LoadWAVStream(src, &wavespec, &wave->start, &wave->stop); } else if ( magic == FORM ) { wave->src = LoadAIFFStream(src, &wavespec, &wave->start, &wave->stop); } else { Mix_SetError("Unknown WAVE format"); SDL_free(wave); // Thses 2 lines should be added. return(NULL); // } Cheers....