Merge pull request #4535 from Memphiz/fixchannelmap
authorTrent Nelson <trent.a.b.nelson@gmail.com>
Thu, 10 Apr 2014 16:43:33 +0000 (10:43 -0600)
committerTrent Nelson <trent.a.b.nelson@gmail.com>
Thu, 10 Apr 2014 17:40:06 +0000 (11:40 -0600)
[osxsink] - fix bad access when device announces more then 8 channels - ...

xbmc/cores/AudioEngine/Sinks/AESinkDARWINOSX.cpp

index b539244..07a877c 100644 (file)
@@ -513,7 +513,7 @@ bool CAESinkDARWINOSX::Initialize(AEAudioFormat &format, std::string &device)
   { /* update the channel count.  We assume that they're layed out as given in CAChannelMap.
        if they're not, this is plain wrong */
     format.m_channelLayout.Reset();
-    for (unsigned int i = 0; i < outputFormat.mChannelsPerFrame; i++)
+    for (unsigned int i = 0; i < outputFormat.mChannelsPerFrame && i < CA_MAX_CHANNELS; i++)
       format.m_channelLayout += CAChannelMap[i];
   }