[vlc-commits] [Git][videolan/vlc][master] coreaudio: fix stack overflow in MapOutputLayout()

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Nov 23 07:01:10 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
5225251c by Thomas Guillem at 2023-11-23T06:41:32+00:00
coreaudio: fix stack overflow in MapOutputLayout()

When outlayout->mNumberChannelDescriptions is bigger than AOUT_CHAN_MAX.

Fixes #28424

- - - - -


1 changed file:

- modules/audio_output/coreaudio_common.c


Changes:

=====================================
modules/audio_output/coreaudio_common.c
=====================================
@@ -648,6 +648,7 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt,
                         "for 7.1 Rear Surround");
         }
 
+        size_t chans_out_idx = 0;
         for (unsigned i = 0; i < outlayout->mNumberChannelDescriptions; i++)
         {
             AudioChannelLabel chan =
@@ -659,15 +660,12 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt,
                 AudioChannelLabelToVlcChan(chan, swap_rear_surround == 2);
             if (mapped_chan != 0)
             {
-                chans_out[i] = mapped_chan;
+                chans_out[chans_out_idx++] = mapped_chan;
                 fmt->i_physical_channels |= mapped_chan;
             }
             else
-            {
-                chans_out[i] = 0;
                 msg_Dbg(p_aout, "found nonrecognized channel %d at index "
                         "%u", (int) chan, i);
-            }
         }
         if (fmt->i_physical_channels == 0)
         {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5225251ce1c774f2aace2fc4de6ded85e00a9225

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5225251ce1c774f2aace2fc4de6ded85e00a9225
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list