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

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Nov 24 11:53:18 UTC 2023



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
5d465814 by Thomas Guillem at 2023-11-24T11:33:46+00:00
coreaudio: fix stack overflow in MapOutputLayout()

When outlayout->mNumberChannelDescriptions is bigger than AOUT_CHAN_MAX.

Fixes #28424

(cherry picked from commit 5225251ce1c774f2aace2fc4de6ded85e00a9225)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

- - - - -


1 changed file:

- modules/audio_output/coreaudio_common.c


Changes:

=====================================
modules/audio_output/coreaudio_common.c
=====================================
@@ -736,6 +736,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 =
@@ -747,15 +748,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 "
                         "%d", chan, i);
-            }
         }
         if (fmt->i_physical_channels == 0)
         {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5d465814936c29a935bacb29810e6355d444d4b7

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5d465814936c29a935bacb29810e6355d444d4b7
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