From patchwork Mon Sep 18 23:04:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 5187 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp4001748jaa; Mon, 18 Sep 2017 16:05:24 -0700 (PDT) X-Google-Smtp-Source: AOwi7QB+CTvQyoNxKAQKZEmrlg5ZmwW5AI+qqLA+017D1htxTYcfmBCRVpt24SATyPvKLwJq2bLx X-Received: by 10.28.228.213 with SMTP id b204mr9941450wmh.157.1505775924140; Mon, 18 Sep 2017 16:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505775924; cv=none; d=google.com; s=arc-20160816; b=kWoN06Q2JBX7r2DAy95CJXdJUN6bEMSTXDft8WJwELvoqp+Zr6RzUV4TwIdSl1UcLo lzGnil2gVX+3WTAStdyu9WaWKdxraUc1h/SDnINCwWkZ8rOhgFhLuD/77p7ipfY4uv5y 9k0wq82peB5TvDjbdX7OUqISVRSbNdgA3GYneRVfhNAi4GjQuUd5cwzO+xXmg6Ykxcpy KI0qtzLFinnUzGCkquo7b1kNECYz0jfbHyjQkLi/JYwtbnm2nA0dclmM9wgMaIAta7f9 2yUGRg69CAQB48QtJ5BZnZHJorFKGOun3yGB09WBfv478mCPpLe62x9qI5jyvm2NfEDx Jyog== 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:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=IBVUNHX4TSCMJNSxw55vnrGVasEWiKMR2ogL4S3Fp7c=; b=vkOgDl0RFAkfIWVekCYTRM37KDNrcJfJSCfTBOE6urmeomn0EVE7p7StNu82XQArzS QV45/MiKJY0nU/7udLTTbo6lDnbt/EQojOl/1MsPJS+uExzEmba/FnWcDZfZkIWqOxHf kMXuDuaLiV3BlFzcJ4Q/l6xKw5AvytLG7znMz4FiSNB6uaTlGN3DIgZ5N+dKfAR9mI/+ I+g0tHc+7E6CUqmcun6M+bp/bsLBSKacxMhGbbpdPNdZd1JWLQFmeF9OhHCm+iuCimBF yKdm5BPw5gV5ktdnGTcTlMQgtGXdl6YUAWXTPcOp4ReasTE8Jo8lk2LRUr70w56dLww4 y95w== 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 o5si6739456wrg.431.2017.09.18.16.05.23; Mon, 18 Sep 2017 16:05:24 -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 2D91C68066B; Tue, 19 Sep 2017 02:05:06 +0300 (EEST) 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 AD662680656 for ; Tue, 19 Sep 2017 02:05:00 +0300 (EEST) Received: from [172.31.218.36] (helo=vie01a-dmta-pe02-3.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1du56D-0007rq-DT for ffmpeg-devel@ffmpeg.org; Tue, 19 Sep 2017 01:05:09 +0200 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 1du568-0004xR-1r for ffmpeg-devel@ffmpeg.org; Tue, 19 Sep 2017 01:05:04 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id BB4u1w01n0S5wYM01B4vJ3; Tue, 19 Sep 2017 01:04:56 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 19 Sep 2017 01:04:53 +0200 Message-Id: <20170918230453.19774-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170918230453.19774-1-michael@niedermayer.cc> References: <20170918230453.19774-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/ffv1dec: Fix integer overflow in read_quant_table() 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: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 3361/clusterfuzz-testcase-minimized-5065842955911168 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/ffv1dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index b13ecd3eab..d2bfee784f 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -372,7 +372,7 @@ static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale) memset(state, 128, sizeof(state)); for (v = 0; i < 128; v++) { - unsigned len = get_symbol(c, state, 0) + 1; + unsigned len = get_symbol(c, state, 0) + 1U; if (len > 128 - i || !len) return AVERROR_INVALIDDATA;