PR #25536 opened by Kilian (lusoris) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25536 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25536.patch
This patch removes a -Wstringop-overflow warning in libavcodec/wmalosslessdec.c that gcc 15.2 reports with -march=x86-64-v3: ``` libavcodec/wmalosslessdec.c:370:38: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] ``` Cause: decode_tilehdr clears contains_subframe per channel with a channel-count bound. decode_init already rejects more than WMALL_MAX_CHANNELS channels and num_channels does not change while decoding, but the compiler does not see that bound at the clear. What the patch does: `avcodec/wmalosslessdec: Clear subframe flags as an array` clears the whole contains_subframe array with memset, bounded by sizeof, before channels are selected on each tiling pass. Each used flag is overwritten as before and the flags of other channels stay zero. Behaviour change: none; fate-lossless-wmall passes. Base: FFmpeg master 86444dd368. Testing, in an ubuntu:26.04 container whose amd64v3 package variant builds gcc 15.2.0-16ubuntu1 with -march=x86-64-v3 by default (`--fatal-warnings --enable-version3 --disable-indevs`, targets build and checkasm): - master 86444dd368 shows 108 warnings; with this patch and the three sibling pull requests (one per area: checkasm/snowdsp, aom_film_grain, vvc/intra_template, wmalosslessdec) it shows 91, the 17 removed are exactly the ones listed in each pull request and no new warning appears. - FATE on that build with all four patches: fate-vvc (38 tests), fate-lossless-wmall (4), fate-film_grain_params, fate-checkasm (including checkasm-snowdsp) and fate-cbs-av1 for both av1-1-b8/b10-23-film_grain-50 samples, 143 tests in all, pass. >From 1bc3fb67b2c9a63dd9031338725aeb8fe30c3cb2 Mon Sep 17 00:00:00 2001 From: lusoris <[email protected]> Date: Tue, 27 Oct 2026 17:06:28 +0100 Subject: [PATCH] avcodec/wmalosslessdec: Clear subframe flags as an array decode_init already rejects more than WMALL_MAX_CHANNELS channels, and num_channels is not reassigned during decoding. The channel-dependent clear in decode_tilehdr nevertheless triggers a stringop-overflow warning with gcc 15.2 with -march=x86-64-v3, also seen for generic x86-64. Clear the whole contains_subframe array before selecting channels on each tiling pass. The clear is now bounded by sizeof rather than the channel count. Each used flag is subsequently overwritten as before; flags for other channels remain zero. No new channel-limit rejection is needed because initialization already enforces the limit. Signed-off-by: lusoris <[email protected]> --- libavcodec/wmalosslessdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index 72d2f31751b..b47b2c406d8 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -357,6 +357,7 @@ static int decode_tilehdr(WmallDecodeCtx *s) int subframe_len, in_use = 0; /* check which channels contain the subframe */ + memset(contains_subframe, 0, sizeof(contains_subframe)); for (c = 0; c < s->num_channels; c++) { if (num_samples[c] == min_channel_len) { if (fixed_channel_layout || channels_for_cur_subframe == 1 || @@ -366,8 +367,7 @@ static int decode_tilehdr(WmallDecodeCtx *s) contains_subframe[c] = get_bits1(&s->gb); } in_use |= contains_subframe[c]; - } else - contains_subframe[c] = 0; + } } if (!in_use) { -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
