From patchwork Tue May 16 22:31:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 3682 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.2 with SMTP id 2csp666776vsk; Tue, 16 May 2017 15:31:40 -0700 (PDT) X-Received: by 10.28.12.211 with SMTP id 202mr8359790wmm.32.1494973900157; Tue, 16 May 2017 15:31:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494973900; cv=none; d=google.com; s=arc-20160816; b=VIuB+wlpQ7AlFWi9r5kyAz92qGAIHsed/SI+SH94N4yeQq1+DIXUNZLXSrb6Whcuj6 BwgN1mm1441M3rlBgnunh10SnY0aKG+0WuifIIJ6kmTxOgtR6APsM9YP7lGPkbqMYJlk Bm3sV63m1YOKNrjdya78KbRbYJ39l2XniIFbxkExs8UR0ZBXCzstGNjydb7EfC26RLFm OXGEj+h3wTogoX8c/REDRU9EWDZUBzHzdC4VYBpyl/nH0htVKM6Hym8SvOqMeMLsKRma Cg9VaWw3F6hsKLpu/2/hyhd64p7Zyu1cDo+blSCtTM+Z5ycmphn0gEu96/NEwRfprR8b sCGw== 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=Mk3bWS8bSA04L1hMgSBx8t07a61c+PReHFOYt1zw1Ck=; b=KhUt+j3b2N5pbditB/3SfeGTfSlEVWCQlyX0kZEiVGc/m1zxLDTMEblAMIf2Jh2NoR z9Gwo0BrHOk8hc6jHKIcgHg7n5uKblvf6viultWH/vwDrVbhxGm9GnUNy3b9CndbiSaO rJJ1qzv4qcY951I5g53nO4ADkLw6P0oKbMsWFpxlI/EWfI5udoSoIg1xJxO9ELuc7laq 8wt6m8sAaCO3cepwjDE6o0H2ev7qA3N45CXhYxS6f+VHVNeXf9pn9sZxol7KPY5TV7og Ha4BkSIA4OmN7frN4+/YUTkxNkjr7ZKFA8AarZy72fP4Qx+pp+Z+Uih+aK1V+4MPY16N /pow== 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 l67si15191932wmf.62.2017.05.16.15.31.39; Tue, 16 May 2017 15:31:40 -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 E511068830E; Wed, 17 May 2017 01:31:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe02-2.mx.upcmail.net (vie01a-dmta-pe02-2.mx.upcmail.net [62.179.121.158]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 54A67688249 for ; Wed, 17 May 2017 01:31:29 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dAl04-0002t9-Hx for ffmpeg-devel@ffmpeg.org; Wed, 17 May 2017 00:31:28 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id MAXL1v00X0S5wYM01AXMhm; Wed, 17 May 2017 00:31:21 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 17 May 2017 00:31:18 +0200 Message-Id: <20170516223118.19122-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH] avcodec/takdec: Fix runtime error: signed integer overflow: 8192 * 524308 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: 1630/clusterfuzz-testcase-minimized-6326111917047808 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/takdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c index 42939b4058..4cfb95a893 100644 --- a/libavcodec/takdec.c +++ b/libavcodec/takdec.c @@ -267,11 +267,11 @@ static int decode_segment(TAKDecContext *s, int8_t mode, int32_t *decoded, int l code = xcodes[mode - 1]; for (i = 0; i < len; i++) { - int x = get_bits_long(gb, code.init); + unsigned x = get_bits_long(gb, code.init); if (x >= code.escape && get_bits1(gb)) { x |= 1 << code.init; if (x >= code.aescape) { - int scale = get_unary(gb, 1, 9); + unsigned scale = get_unary(gb, 1, 9); if (scale == 9) { int scale_bits = get_bits(gb, 3); if (scale_bits > 0) {