diff mbox

[FFmpeg-devel,1/2] avcodec/truemotion2: Fix integer overflow in tm2_decode_blocks()

Message ID 20190327001742.16131-1-michael@niedermayer.cc
State Accepted
Commit 0ad0533e914a2618aea1dc77748037bd8459f61d
Headers show

Commit Message

Michael Niedermayer March 27, 2019, 12:17 a.m. UTC
Fixes: signed integer overflow: 255 + 2147483634 cannot be represented in type 'int'
Fixes: 13472/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5712444142387200

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

Comments

Michael Niedermayer April 13, 2019, 5:13 p.m. UTC | #1
On Wed, Mar 27, 2019 at 01:17:41AM +0100, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 255 + 2147483634 cannot be represented in type 'int'
> Fixes: 13472/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5712444142387200
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/truemotion2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index 18719dae1c..100880c257 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -837,7 +837,7 @@  static int tm2_decode_blocks(TM2Context *ctx, AVFrame *p)
     dst = p->data[0];
     for (j = 0; j < h; j++) {
         for (i = 0; i < w; i++) {
-            int y = Y[i], u = U[i >> 1], v = V[i >> 1];
+            unsigned y = Y[i], u = U[i >> 1], v = V[i >> 1];
             dst[3*i+0] = av_clip_uint8(y + v);
             dst[3*i+1] = av_clip_uint8(y);
             dst[3*i+2] = av_clip_uint8(y + u);