film grain: set luma grain to 0 when num_y_point is zero
Avoids overflow when tested with sanitizer
Non-normative since overflown values were not used
BUG=aomedia:2018
BUG=oss-fuzz:9376
Change-Id: I366416d6b53412c4e8f7a880757276cc274edeb7
diff --git a/aom_dsp/grain_synthesis.c b/aom_dsp/grain_synthesis.c
index 2e716f8..ff1ec41 100644
--- a/aom_dsp/grain_synthesis.c
+++ b/aom_dsp/grain_synthesis.c
@@ -400,7 +400,11 @@
const aom_film_grain_t *params, int **pred_pos_luma, int *luma_grain_block,
int luma_block_size_y, int luma_block_size_x, int luma_grain_stride,
int left_pad, int top_pad, int right_pad, int bottom_pad) {
- if (params->num_y_points == 0) return;
+ if (params->num_y_points == 0) {
+ memset(luma_grain_block, 0,
+ sizeof(*luma_grain_block) * luma_block_size_y * luma_grain_stride);
+ return;
+ }
int bit_depth = params->bit_depth;
int gauss_sec_shift = 12 - bit_depth + params->grain_scale_shift;