From patchwork Thu May 18 01:54:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 3693 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.2 with SMTP id 2csp453485vsk; Wed, 17 May 2017 18:54:50 -0700 (PDT) X-Received: by 10.28.232.3 with SMTP id f3mr899949wmh.138.1495072490156; Wed, 17 May 2017 18:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495072490; cv=none; d=google.com; s=arc-20160816; b=zLltGUd7yK7JjbyV4sWkbAEsvsLbYe+t6SXb/RhlNVhfsKJjzETaGvKI3DQuWei8rc kxiZm2tMJ4OuPO18zKNIESB+J2dXtZb9dhehQJ/C5yrhuSIPIVZpzq+DkhbeTA4MnJuH Ponn+Jl+ML+tm7jxRRmhBH7DuIVM+E0j6yd+ZAVZCIg9nhUQr6bHPjIwLEVx293j7MSW TWE4Fhcr03ZqUF5MhjZeFwXan09mg0SuJRwR4q9rEx4FdAzwYSXlu2eYIm5P0R1W2R/I LryeaLDao5pBNDflgonjvWSLT8lobEbPQ9dHHEJnvkjFXOkb2tm0qtef+v0Q59xbuOcj bfng== 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=AXHhnt99TYKAAiOosn0h+mO8irtNBTEt915TeLl57Vc=; b=jV2qRgEy30D6HXoS2DzF63BgWhJ/lJX3GXKKgBZFuCWek5cgmfESC2DFNJsnlEoBW1 G94cxgVSokV/lAVc3lWyhJgm5TFZ7oFsSMzX5pLDLAQZCcm6xMGxpEm3En5CMeAUkcvn cTSxnJKPbTHkmPVebgXAGg8fbvZX5VacdVXdVz8rYpbZ68bGBmKczoXFIEH5kC1/Httk cnrt4aENbf1NM6KixRSkfLkSCvmrAb8JEnliIKH1zvpR0ATg1lEM/LnsOTldJS62VM1f P55qlIsciTkL3Oor6LKBI39XVAytqn6LGx3QQlY7Iuv1wh6D77Nw8rQA99PAsFCw65S9 7Pbw== 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 g26si4325936wrb.36.2017.05.17.18.54.49; Wed, 17 May 2017 18:54:50 -0700 (PDT) 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 8A452689882; Thu, 18 May 2017 04:54:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-2.mx.upcmail.net (vie01a-qmta-pe02-2.mx.upcmail.net [62.179.121.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7C8896879A0 for ; Thu, 18 May 2017 04:54:39 +0300 (EEST) Received: from [172.31.218.43] (helo=vie01a-dmta-pe05-1.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dBAeE-0007T1-Rf for ffmpeg-devel@ffmpeg.org; Thu, 18 May 2017 03:54:38 +0200 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 1dBAe9-0001Sw-57 for ffmpeg-devel@ffmpeg.org; Thu, 18 May 2017 03:54:33 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id MduW1v0040S5wYM01duXCS; Thu, 18 May 2017 03:54:32 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 18 May 2017 03:54:29 +0200 Message-Id: <20170518015429.18150-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH] avcodec/wavpack: Fix multiple runtime error: signed integer overflow: 548 * -2147483648 cannot be represented in type 'int' 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: 1659/clusterfuzz-testcase-minimized-5396490639900672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/wavpack.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 87c065c1e7..74ca2d492c 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -433,8 +433,8 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, L2 = L + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10); R2 = R + ((s->decorr[i].weightB * (int64_t)B + 512) >> 10); } else { - L2 = L + ((int)(s->decorr[i].weightA * A + 512U) >> 10); - R2 = R + ((int)(s->decorr[i].weightB * B + 512U) >> 10); + L2 = L + ((int)(s->decorr[i].weightA * (unsigned)A + 512) >> 10); + R2 = R + ((int)(s->decorr[i].weightB * (unsigned)B + 512) >> 10); } if (A && L) s->decorr[i].weightA -= ((((L ^ A) >> 30) & 2) - 1) * s->decorr[i].delta; @@ -446,13 +446,13 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, if (type != AV_SAMPLE_FMT_S16P) L2 = L + ((s->decorr[i].weightA * (int64_t)s->decorr[i].samplesA[0] + 512) >> 10); else - L2 = L + ((s->decorr[i].weightA * s->decorr[i].samplesA[0] + 512) >> 10); + L2 = L + ((int)(s->decorr[i].weightA * (unsigned)s->decorr[i].samplesA[0] + 512) >> 10); UPDATE_WEIGHT_CLIP(s->decorr[i].weightA, s->decorr[i].delta, s->decorr[i].samplesA[0], L); L = L2; if (type != AV_SAMPLE_FMT_S16P) R2 = R + ((s->decorr[i].weightB * (int64_t)L2 + 512) >> 10); else - R2 = R + ((s->decorr[i].weightB * L2 + 512) >> 10); + R2 = R + ((int)(s->decorr[i].weightB * (unsigned)L2 + 512) >> 10); UPDATE_WEIGHT_CLIP(s->decorr[i].weightB, s->decorr[i].delta, L2, R); R = R2; s->decorr[i].samplesA[0] = R; @@ -460,7 +460,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, if (type != AV_SAMPLE_FMT_S16P) R2 = R + ((s->decorr[i].weightB * (int64_t)s->decorr[i].samplesB[0] + 512) >> 10); else - R2 = R + ((s->decorr[i].weightB * s->decorr[i].samplesB[0] + 512) >> 10); + R2 = R + ((int)(s->decorr[i].weightB * (unsigned)s->decorr[i].samplesB[0] + 512) >> 10); UPDATE_WEIGHT_CLIP(s->decorr[i].weightB, s->decorr[i].delta, s->decorr[i].samplesB[0], R); R = R2; @@ -472,7 +472,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, if (type != AV_SAMPLE_FMT_S16P) L2 = L + ((s->decorr[i].weightA * (int64_t)R2 + 512) >> 10); else - L2 = L + ((s->decorr[i].weightA * R2 + 512) >> 10); + L2 = L + ((int)(s->decorr[i].weightA * (unsigned)R2 + 512) >> 10); UPDATE_WEIGHT_CLIP(s->decorr[i].weightA, s->decorr[i].delta, R2, L); L = L2; s->decorr[i].samplesB[0] = L;