From patchwork Sat Jan 20 03:50:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7354 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.156.27 with SMTP id q27csp297394jak; Fri, 19 Jan 2018 19:50:51 -0800 (PST) X-Google-Smtp-Source: AH8x225L7wM2VmRR+U1Vz/YzK2ZiWkyuteDXiQmmgg2xZYXfedQnWd2FLJa9vlrnlwpPqMe+zUTq X-Received: by 10.28.12.193 with SMTP id 184mr163628wmm.121.1516420251811; Fri, 19 Jan 2018 19:50:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516420251; cv=none; d=google.com; s=arc-20160816; b=PjH80d5D/4k6MZ1VL9jEGSBr+kJvlxXohL7OnxwMUd0lLztNZwzPsYITxccdEXC8ki Ti4qH3uWVZlnYQKxYMQ+8406aCRH7DfNVIZW43CM8hmzlel3T/2BD6O1HGBJggz/zb+a HhDgQB0g9gOOTLnp02CW1Nw9YM31a9eytqw4Xfty4MZKZ1cmYYcgr8O4rtPPFV+FmOGf B0yDAv9z/Xxnn0ZPHlL4fB7+TIXfBQBaCJrhSTPpD9YkBOE5S2euHdWx+agSOQwo5go0 RUGI3Rs0a7xYU0isGkJoKluPgLcy4vyqejN3iwJPO1X+qcEoBNeSr91F3U2CPxm2z3/8 YxVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=PLyYWvYhHqFrqxpwqsaa7t9m531Sr6UfxuJ6BJG5Zvc=; b=R7UGDR+0XksH3wzjUqTtFS+n3acyftNptdmGLMI8O1hQtnzw2orvw92r6i9RJuPWjy yWRyrTGk5DSYywxIglLEZFChL+urX0CfGGaeoXET0TP7xr04H2+AJS0dzU/jsQWqtLuI hKhRPU5fqbLTmWcdgPCK3fxn92gLH9fLbDaVIouBl3jciZjFCSiO3UIXQ4+u+scOsANb O6QCQFdcVXsQxgiE202aICD6YQb6IkBvL73KitkVUu9JmKZx1VszaGJZu6K/H4/HdnaY gSrJleHXtIghBcE1g6w1f05EOhZn70kV33HCuBuBrpEdf+net7Oo5fGOoBjCHhHwFiNw elIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u2si1644028wru.419.2018.01.19.19.50.50; Fri, 19 Jan 2018 19:50:51 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8D182689A70; Sat, 20 Jan 2018 05:50:48 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-1.mx.upcmail.net (vie01a-qmta-pe02-1.mx.upcmail.net [62.179.121.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9439E689A34 for ; Sat, 20 Jan 2018 05:50:42 +0200 (EET) Received: from [172.31.218.45] (helo=vie01a-dmta-pe05-3.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eckB0-00078v-JK for ffmpeg-devel@ffmpeg.org; Sat, 20 Jan 2018 04:50:42 +0100 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eckAu-0003HV-Ot for ffmpeg-devel@ffmpeg.org; Sat, 20 Jan 2018 04:50:36 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 0TqW1x00Z0S5wYM01TqXdj; Sat, 20 Jan 2018 04:50:31 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 20 Jan 2018 04:50:29 +0100 Message-Id: <20180120035029.20387-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.15.1 Subject: [FFmpeg-devel] [PATCH] avcodec/truemotion2: Fix integer overflow in TM2_RECALC_BLOCK() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes: signed integer overflow: 1477974040 - -1877995504 cannot be represented in type 'int' Fixes: 4861/clusterfuzz-testcase-minimized-4570316383715328 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/truemotion2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index f077f0e4bd..97c38f7f08 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -441,8 +441,8 @@ static inline int GET_TOK(TM2Context *ctx,int type) /* recalculate last and delta values for next blocks */ #define TM2_RECALC_BLOCK(CHR, stride, last, CD) {\ - CD[0] = CHR[1] - last[1];\ - CD[1] = (int)CHR[stride + 1] - (int)CHR[1];\ + CD[0] = (unsigned)CHR[ 1] - (unsigned)last[1];\ + CD[1] = (unsigned)CHR[stride + 1] - (unsigned) CHR[1];\ last[0] = (int)CHR[stride + 0];\ last[1] = (int)CHR[stride + 1];}