Ver Fonte

Fix #13276: Crash in SDL_GetAudioDeviceChannelMap

(cherry picked from commit de6a23028a2c7c05aa4f591969df1c9bb0f46003)
Paul Vick há 3 meses atrás
pai
commit
554bee6aae
1 ficheiros alterados com 3 adições e 1 exclusões
  1. 3 1
      src/audio/SDL_audio.c

+ 3 - 1
src/audio/SDL_audio.c

@@ -1575,7 +1575,9 @@ int *SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count)
     SDL_AudioDevice *device = ObtainPhysicalAudioDeviceDefaultAllowed(devid);
     if (device) {
         channels = device->spec.channels;
-        result = SDL_ChannelMapDup(device->chmap, channels);
+        if (channels > 0 && device->chmap) {
+            result = SDL_ChannelMapDup(device->chmap, channels);
+        }
     }
     ReleaseAudioDevice(device);