diff mbox series

[FFmpeg-devel,2/3] avcodec/h274: fix bad left shifts

Message ID 20210914205820.12598-2-michael@niedermayer.cc
State Accepted
Commit 991b3deea90c6fc01ec575522760f58c650eba11
Headers show
Series [FFmpeg-devel,1/3] avcodec/mxpegdec: Check for AVDISCARD_ALL
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Michael Niedermayer Sept. 14, 2021, 8:58 p.m. UTC
Fixes: left shift of negative value -3
Fixes: 37788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6024714540154880

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/h274.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/h274.c b/libavcodec/h274.c
index 262106733ce..20401ba06bb 100644
--- a/libavcodec/h274.c
+++ b/libavcodec/h274.c
@@ -250,8 +250,8 @@  int ff_h274_apply_film_grain(AVFrame *out_frame, const AVFrame *in_frame,
             // Adaptation for 4:2:0 chroma subsampling
             for (int i = 0; i < h274.num_intensity_intervals[c]; i++) {
                 h274.comp_model_value[c][i][0] >>= 1;
-                h274.comp_model_value[c][i][1] <<= 1;
-                h274.comp_model_value[c][i][2] <<= 1;
+                h274.comp_model_value[c][i][1] *= 2;
+                h274.comp_model_value[c][i][2] *= 2;
             }
         }