Commit da923bdb41 for ffmpeg

commit da923bdb41fc9ec3bb2d0277e6176afdbfed4300
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Tue Nov 17 00:34:52 2026 +0100

    avcodec/aom_film_grain: do not apply chroma grain to frames without chroma

    NULL pointer dereference Replicated through UnModified FFmpeg with ASAN

    Fixes: NULL pointer dereference
    Fixes: 583284275/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6553010445287424
    Fixes: 583493829/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4542557191995392
    Fixes: rcYbsa3hpgAg
    Regression since: 14746871e1d33de172d6cb32730d962068e3ccd2

    Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
    Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

diff --git a/libavcodec/aom_film_grain_template.c b/libavcodec/aom_film_grain_template.c
index 5f9f29f1fa..b98639c6ca 100644
--- a/libavcodec/aom_film_grain_template.c
+++ b/libavcodec/aom_film_grain_template.c
@@ -507,7 +507,8 @@ FUNC(apply_grain_row)(AVFrame *out, const AVFrame *in,
                             grain_lut[0], bh, row HBD_CALL);
     }

-    if (!data->num_uv_points[0] && !data->num_uv_points[1] &&
+    if (!out->data[1] ||
+        !data->num_uv_points[0] && !data->num_uv_points[1] &&
         !data->chroma_scaling_from_luma)
     {
         return;