[vlc-commits] [Git][videolan/vlc][3.0.x] amem: fix integer overflow above 262143Hz
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Nov 12 06:39:40 UTC 2026
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
4df48bc6 by Farid Hammane at 2026-11-12T06:30:34+00:00
amem: fix integer overflow above 262143Hz
The variable 'rate' in aout_sys_t had 18bits, which was not enough to represent
values greater than 262143.
This patch also fixes an inconsistency in the number of supported channels.
According to source code, where channel mapping is configured, amem only
supports 8 channels.
Signed-off-by: Farid Hammane <farid.hammane at gmail.com>
(cherry picked from commit 6ebfc44e4dd770eb809f96c511e63eba51507746)
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
- - - - -
1 changed file:
- modules/audio_output/amem.c
Changes:
=====================================
modules/audio_output/amem.c
=====================================
@@ -31,6 +31,7 @@ static int Open (vlc_object_t *);
static void Close (vlc_object_t *);
#define AMEM_SAMPLE_RATE_MAX 384000
+#define AMEM_CHAN_MAX 8
vlc_module_begin ()
set_shortname (N_("Audio memory"))
@@ -49,7 +50,7 @@ vlc_module_begin ()
change_private()
add_integer ("amem-channels", 2,
N_("Channels count"), N_("Channels count"), false)
- change_integer_range (1, AOUT_CHAN_MAX)
+ change_integer_range (1, AMEM_CHAN_MAX)
change_private()
vlc_module_end ()
@@ -67,8 +68,8 @@ struct aout_sys_t
};
struct
{
- unsigned rate:18;
- unsigned channels:14;
+ unsigned rate;
+ uint8_t channels;
};
};
void (*play) (void *opaque, const void *data, unsigned count, int64_t pts);
@@ -189,7 +190,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt)
/* Ensure that format is supported */
if (fmt->i_rate == 0 || fmt->i_rate > AMEM_SAMPLE_RATE_MAX
- || channels == 0 || channels > AOUT_CHAN_MAX
+ || channels == 0 || channels > AMEM_CHAN_MAX
|| strcmp(format, "S16N") /* TODO: amem-format */)
{
msg_Err (aout, "format not supported: %s, %u channel(s), %u Hz",
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4df48bc680549cb1ec1fa264e8fe8c059ec402ec
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4df48bc680549cb1ec1fa264e8fe8c059ec402ec
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list