[FFmpeg-devel,3/3] avcodec/vc1_pred: Fix invalid shift in scaleforsame()

Submitted by Michael Niedermayer on July 11, 2019, 12:29 p.m.

Details

Message ID 20190711122918.20176-3-michael@niedermayer.cc
State Accepted
Commit 6dfda35dd29d2e2a86554d2c05d957a09ab79b0c
Headers show

Commit Message

Michael Niedermayer July 11, 2019, 12:29 p.m.
Fixes: left shift of negative value -1
Fixes: 15531/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5759556258365440

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

Comments

Michael Niedermayer July 31, 2019, 6:06 p.m.
On Thu, Jul 11, 2019 at 02:29:18PM +0200, Michael Niedermayer wrote:
> Fixes: left shift of negative value -1
> Fixes: 15531/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1IMAGE_fuzzer-5759556258365440
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vc1_pred.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/vc1_pred.c b/libavcodec/vc1_pred.c
index 9e29b44a1f..16565063ea 100644
--- a/libavcodec/vc1_pred.c
+++ b/libavcodec/vc1_pred.c
@@ -178,7 +178,7 @@  static av_always_inline int scaleforsame(VC1Context *v, int i, int n /* MV */,
     brfd      = FFMIN(v->brfd, 3);
     scalesame = ff_vc1_b_field_mvpred_scales[0][brfd];
 
-    n = (n * scalesame >> 8) << hpel;
+    n = (n * scalesame >> 8) * (1 << hpel);
     return n;
 }