From patchwork Wed Jan 31 02:17:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7453 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.156.27 with SMTP id q27csp1095029jak; Tue, 30 Jan 2018 18:17:55 -0800 (PST) X-Google-Smtp-Source: AH8x224zuwQC3fvNLbNA8SRa5LxIWZxm4Yw+iT9oAC9jwRtDL7FexwvLKW1b7cvuodKCcdHiSW9u X-Received: by 10.223.171.194 with SMTP id s60mr25176783wrc.250.1517365075606; Tue, 30 Jan 2018 18:17:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517365075; cv=none; d=google.com; s=arc-20160816; b=ejIUuctPzsUx3udMfVGDu/Ek49RzogwnthJ/T4n3OLrhmmo8RE7lhNDGtzACXoMak/ pD32gCO8LCv9h2VEtxBzo0+aT5pTzQR7sZyzXYHfXTz1YxgC1JbuwYk0bOj1Kjdy8H2+ KjLnnw4MFFR66yBEx6Bku7CAEnxXskaJ2h/gpzjc2DUnlNYkWvsAgsczVyuNqxYN2EJF Mdk2RA8paQqb+8/HPwnawjPBsprc2XR1f86mr033jHMmi2+ZBiDIYC7sOKWZAxiiU1/z sRbPsDPDYhJmwf/wI1yIYvbLBqFnQeJlKlF1l7r79jazsT8hQ31W4FQNKo3PvbLX/nAy rE8g== 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=B6tSdxbI8PzpfipbToPMHykAKAWasZmI4oK/eyaKY+g=; b=Plmu7IHjWldo7e5HwKwLl8LRjedymIbXiYil0P2OwMTzayLLmsyNUqRuUaUgBqjEln Q1skM1Iov8Z6PL48wgYDpBcaBO6oDFQ2wN5cRFbTwb4j9+UezLlgY8vqy20SZHgqjkjP ZYmZm0QuBkHms3VDHsYL/5LkUwdMOvcCPWHTF6aXsw9hbCT+yo1uu0TB0XUzcJpNE8mM BTZiT7+qYuKX5aTmu2ONM8IsRPBBkPSYYCj5hTUzv880tJP+QayJdkISV5LeuZ3Nqnd+ o7orQ5vhPkrW1QuwAzicEWQT1Ui0+f7JeDzC03bS6hu9idtt/HEyysLRpEyjxpcjdzSH 7l7A== 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 88si6371642wro.526.2018.01.30.18.17.54; Tue, 30 Jan 2018 18:17:55 -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 903DE689A03; Wed, 31 Jan 2018 04:17:47 +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 A6CD4680D4E for ; Wed, 31 Jan 2018 04:17:41 +0200 (EET) Received: from [172.31.218.44] (helo=vie01a-dmta-pe05-2.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eghy6-0006SU-HF for ffmpeg-devel@ffmpeg.org; Wed, 31 Jan 2018 03:17:46 +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 1eghy1-00061t-2K for ffmpeg-devel@ffmpeg.org; Wed, 31 Jan 2018 03:17:41 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 4qHc1x01Z0S5wYM01qHdxr; Wed, 31 Jan 2018 03:17:38 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 31 Jan 2018 03:17:36 +0100 Message-Id: <20180131021736.6362-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.16.1 Subject: [FFmpeg-devel] [PATCH] avcodec/wavpack: Fix integer overflow in FFABS 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: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: 5396/clusterfuzz-testcase-minimized-6558555529281536 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/wavpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index d5e1e07b74..0e40b29879 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -480,7 +480,7 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, } if (type == AV_SAMPLE_FMT_S16P) { - if (FFABS(L) + (unsigned)FFABS(R) > (1<<19)) { + if (FFABS((int64_t)L) + FFABS((int64_t)R) > (1<<19)) { av_log(s->avctx, AV_LOG_ERROR, "sample %d %d too large\n", L, R); return AVERROR_INVALIDDATA; }