PR #25534 opened by Kilian (lusoris) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25534 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25534.patch
This patch removes a -Wstringop-overflow warning in libavcodec/aom_film_grain.c that gcc 15.2 reports with -march=x86-64-v3: ``` libavcodec/aom_film_grain.c:236:41: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] ``` Cause: the predicted luma path copies num_y_points from the reference set before it indexes res[14] and y_points[14]. The reference set was checked when it was parsed, but the compiler does not carry that bound to this loop. What the patch does: `avcodec/aom_film_grain: Check the predicted luma point count` checks the copied count against the array size before both loops and takes the existing error path when it is larger. Behaviour change: an oversized reference count now returns an error here instead of relying on the earlier check; valid streams parse as before. 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 4230e50be2a9b56087e2d49bf62fd43e3e65f89a Mon Sep 17 00:00:00 2001 From: lusoris <[email protected]> Date: Tue, 27 Oct 2026 17:06:28 +0100 Subject: [PATCH] avcodec/aom_film_grain: Check the predicted luma point count The predicted luma path copies the reference point count before indexing res[14] and y_points[14]. The first reference set is checked when parsed, but gcc 15.2 with -march=x86-64-v3 does not retain that bound here and reports a stringop-overflow warning. Check the copied count before both loops, using the existing error path. This makes the upper bound local and protects the arrays against an oversized reference count without changing valid streams. Signed-off-by: lusoris <[email protected]> --- libavcodec/aom_film_grain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/aom_film_grain.c b/libavcodec/aom_film_grain.c index bb60c557741..9b836be2755 100644 --- a/libavcodec/aom_film_grain.c +++ b/libavcodec/aom_film_grain.c @@ -225,6 +225,8 @@ int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s, if (bits_res) { int res[14], pred, granularity; aom->num_y_points = ref->codec.aom.num_y_points; + if (aom->num_y_points > 14) + goto error; for (i = 0; i < aom->num_y_points; i++) res[i] = get_bits(gb, bits_res); granularity = get_bits(gb, 3); -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
