PR #25535 opened by Kilian (lusoris) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25535 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25535.patch
This patch removes twelve -Wstringop-overflow warnings in libavcodec/vvc/intra_template.c that gcc 15.2 reports with -march=x86-64-v3 (six at each of these two lines): ``` libavcodec/vvc/intra_template.c:534:21: warning: writing 32 bytes into a region of size 0 [-Wstringop-overflow=] libavcodec/vvc/intra_template.c:536:21: warning: writing 32 bytes into a region of size 0 [-Wstringop-overflow=] ``` Cause: the corner extension writes at most four samples before the top and left origins, which have MAX_TB_SIZE + 3 samples of headroom, so the negative indices are valid. The loop condition does not state that limit, and the vectorizer assumes stores before the start of the edge buffer. What the patch does: `avcodec/vvc/intra_template: Bound reference corner extension` adds the four-sample limit to the loop condition, so every corner index is bounded to [-4, -1] and the trip count to four, independent of the reference index the caller passes. Behaviour change: none; valid reference lines produce the same samples (fate-vvc 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 c626c348a9512538d443dd0df91801fc5219bd2f Mon Sep 17 00:00:00 2001 From: lusoris <[email protected]> Date: Tue, 27 Oct 2026 17:06:28 +0100 Subject: [PATCH] avcodec/vvc/intra_template: Bound reference corner extension The corner extension uses at most four samples before the top and left origins. Those origins have MAX_TB_SIZE + 3 samples of headroom, so the negative indices are valid. However, the ref_idx range is not explicit in this loop, and gcc 15.2 with -march=x86-64-v3 reports vector stores before the edge object. State the four-sample limit in the loop condition. The compiler can now bound every corner index to [-4, -1] and the trip count to four, independently of the caller's reference index. Valid reference lines produce exactly the same samples. Signed-off-by: lusoris <[email protected]> --- libavcodec/vvc/intra_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vvc/intra_template.c b/libavcodec/vvc/intra_template.c index 3ec6c72213e..e1f2c512e41 100644 --- a/libavcodec/vvc/intra_template.c +++ b/libavcodec/vvc/intra_template.c @@ -526,7 +526,7 @@ do { \ top_available = ff_vvc_get_top_available(lc, x, y, unfilter_top_size, c_idx); memcpy(top, src + ref_line * stride, top_available * sizeof(pixel)); - for (int i = -1; i >= ref_line; i--) { + for (int i = -1; i >= ref_line && i >= -4; i--) { if (cand_up_left) { left[i] = POS(ref_line, i); top[i] = POS(i, ref_line); -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
