diff mbox series

[FFmpeg-devel] avcodec/dxtory: Fix undefined shift with negative linesize

Message ID 20210222165156.29864-1-michael@niedermayer.cc
State Accepted
Commit f01d522cf36d5f6810887bb70d24036778b6ea07
Headers show
Series [FFmpeg-devel] avcodec/dxtory: Fix undefined shift with negative linesize
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer Feb. 22, 2021, 4:51 p.m. UTC
Fixes: left shift of negative value -128
Fixes: 30746/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXTORY_fuzzer-5906271469436928

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

Comments

Paul B Mahol Feb. 22, 2021, 4:56 p.m. UTC | #1
lgtm
Michael Niedermayer Feb. 25, 2021, 7:38 p.m. UTC | #2
On Mon, Feb 22, 2021 at 05:56:31PM +0100, Paul B Mahol wrote:
> lgtm

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/dxtory.c b/libavcodec/dxtory.c
index 7143a11e2e..f314bcec75 100644
--- a/libavcodec/dxtory.c
+++ b/libavcodec/dxtory.c
@@ -264,8 +264,8 @@  static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic,
             V[huvborder] = src[3] + 0x80;
             src += 4;
         }
-        Y1 += pic->linesize[0] << 1;
-        Y2 += pic->linesize[0] << 1;
+        Y1 += pic->linesize[0] * 2;
+        Y2 += pic->linesize[0] * 2;
         U  += pic->linesize[1];
         V  += pic->linesize[2];
     }