From patchwork Mon Aug 20 21:28:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 10045 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp2982160jap; Mon, 20 Aug 2018 14:29:32 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxZbtKQHJlwbg5In2H9xL9AdECYjYGaD7COdmg3UaKps8on/bqU6iIoM416SLSyclOulnEH X-Received: by 2002:adf:a41c:: with SMTP id d28-v6mr11216708wra.121.1534800572642; Mon, 20 Aug 2018 14:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534800572; cv=none; d=google.com; s=arc-20160816; b=Wk0ZWiTo6MLT+ItF1jaVmmDTsgg9qs0l4ZkmVje7HuTvCxq1ptNtXvPvf6OKw9+UoW uU599apn1VE0ooEV8GP6PYE5sM44f5WaPvd7qqYSa37uvBvRXngOvVWz1dxkns6uypu3 PKrj0AGjMrVzkOEUREI+TP5bHumJ8P7AX0F1+xKaOkzUBgUkgn1FobZTwbiXSuG8j7Mv 3CtMd6YY+a3NM937M+ALD/8DYEbw9c7bT4owKRWdFJxe5HVS8I53jqP5u6/vuD50bBo+ DZ7Um/QbS8M85/nFHoXyYUotJDbfScne5NLyVtG/DU8UU8kdt0VJqIdYTKuv+FGmhmd8 pioQ== 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=ytHcxTi+O7fNgEy9hmbahTj3j1Iejc0xhpx/nS69mIw=; b=EVs4L4UF070Uvn+uFpIXeNddlmBnbN5qAYOBw/LKZjUXXeCbwfZTvBKZmzkjD0wQxL ZPJACtbGQOoHt3h4Ea0XudYU+t0lnl32gnTHAECDSle1erG6e0vTId6txJlFDxhHWc/Z ZwrX2LMyj69UmtoFaSjodMthWy1i/xyxTLRi4LlGu7ytY/4wThQVB47+FVA8PvZVBXWn qFMA52J7VgqxIBz/dEX/LtOMR+XMa2aZlLIICPYp8Tp/OkbI/LvwXR5k+zEDnaQsWq2R HEk8y30Vm3R8nzh4hiT85TS3aj8NyLXGGbkAnUfOTc0jvLGi6d33OVl/KR8ncBG9M7Wd EDEA== 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 o192-v6si569454wmg.156.2018.08.20.14.29.32; Mon, 20 Aug 2018 14:29:32 -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 8C9BF689CBF; Tue, 21 Aug 2018 00:28:57 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-3.mx.upcmail.net (vie01a-dmta-pe05-3.mx.upcmail.net [84.116.36.13]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 40C3C689B43 for ; Tue, 21 Aug 2018 00:28:51 +0300 (EEST) 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 1frrji-0004J5-7z for ffmpeg-devel@ffmpeg.org; Mon, 20 Aug 2018 23:29:18 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id RZV81y0140S5wYM01ZVAxK; Mon, 20 Aug 2018 23:29:10 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 20 Aug 2018 23:28:59 +0200 Message-Id: <20180820212901.15317-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/snowdec: Fix integer overflow with motion vector residual 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: -19818 + -2147483648 cannot be represented in type 'int' Fixes: 9545/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-4928769537081344 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/snowdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c index 0146a2a4c9..59bd24e881 100644 --- a/libavcodec/snowdec.c +++ b/libavcodec/snowdec.c @@ -208,8 +208,8 @@ static int decode_q_branch(SnowContext *s, int level, int x, int y){ return AVERROR_INVALIDDATA; } pred_mv(s, &mx, &my, ref, left, top, tr); - mx+= get_symbol(&s->c, &s->block_state[128 + 32*(mx_context + 16*!!ref)], 1); - my+= get_symbol(&s->c, &s->block_state[128 + 32*(my_context + 16*!!ref)], 1); + mx+= (unsigned)get_symbol(&s->c, &s->block_state[128 + 32*(mx_context + 16*!!ref)], 1); + my+= (unsigned)get_symbol(&s->c, &s->block_state[128 + 32*(my_context + 16*!!ref)], 1); } set_blocks(s, level, x, y, l, cb, cr, mx, my, ref, type); }else{