PR #24033 opened by AYOUB NABIL BOUBAGRAT (ayoubnabil) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24033 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24033.patch
AudioToolbox channel labels can map to FFmpeg channel ids 31 through 35. the channel masks used an int literal, making these shifts undefined before conversion to uint64_t. use a 64-bit literal when building the masks in both the encoder and decoder paths. >From b574d03922ed03e6b8b6736e5c32eb7662d3be84 Mon Sep 17 00:00:00 2001 From: Ayoub Nabil Boubagrat <[email protected]> Date: Thu, 6 Aug 2026 18:06:39 +0200 Subject: [PATCH] avcodec/audiotoolbox: use 64-bit channel masks the channel mask expressions used an int literal, making shifts for channel ids 31 and above undefined before conversion to uint64_t. use a 64-bit literal in the encoder mapping and decoder layout mask. Signed-off-by: Ayoub Nabil Boubagrat <[email protected]> --- libavcodec/audiotoolboxdec.c | 4 ++-- libavcodec/audiotoolboxenc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c index 08203c5310..143a10f7f0 100644 --- a/libavcodec/audiotoolboxdec.c +++ b/libavcodec/audiotoolboxdec.c @@ -201,9 +201,9 @@ static int ffat_update_ctx(AVCodecContext *avctx) int id = ffat_get_channel_id(layout->mChannelDescriptions[i].mChannelLabel); if (id < 0) goto done; - if (layout_mask & (1 << id)) + if (layout_mask & (1ULL << id)) goto done; - layout_mask |= 1 << id; + layout_mask |= 1ULL << id; layout->mChannelDescriptions[i].mChannelFlags = i; // Abusing flags as index } av_channel_layout_uninit(&avctx->ch_layout); diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c index 11af7c0154..1aa2ca317b 100644 --- a/libavcodec/audiotoolboxenc.c +++ b/libavcodec/audiotoolboxenc.c @@ -176,7 +176,7 @@ static int get_ilbc_mode(AVCodecContext *avctx) static av_cold int get_channel_label(int channel) { - uint64_t map = 1 << channel; + uint64_t map = 1ULL << channel; if (map <= AV_CH_LOW_FREQUENCY) return channel + 1; else if (map <= AV_CH_BACK_RIGHT) -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
