소스 검색

audio: Fixed potential NULL dereference.

This could happen if you call SDL_BindAudioStreams() when the subsystem isn't
initialized, and possibly in other corner cases.

Thanks to Qianxin CodeSafe Team, @QiAnXinCodeSafe, for discovering this issue!

Fixes #11643.
Ryan C. Gordon 10 달 전
부모
커밋
80b9986418
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/audio/SDL_audio.c

+ 4 - 0
src/audio/SDL_audio.c

@@ -234,6 +234,10 @@ static bool AudioDeviceCanUseSimpleCopy(SDL_AudioDevice *device)
 // should hold device->lock before calling.
 static void UpdateAudioStreamFormatsPhysical(SDL_AudioDevice *device)
 {
+    if (!device) {
+        return;
+    }
+
     if (device->recording) {  // for recording devices, we only want to move to float32 for postmix and gain, which we'll handle elsewhere.
         // we _do_ need to make sure the channel map is correct, though...
         for (SDL_LogicalAudioDevice *logdev = device->logical_devices; logdev; logdev = logdev->next) {