From patchwork Fri Aug 11 21:21:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4696 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp1340623vsu; Fri, 11 Aug 2017 14:21:51 -0700 (PDT) X-Received: by 10.28.88.82 with SMTP id m79mr64771wmb.52.1502486511049; Fri, 11 Aug 2017 14:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502486511; cv=none; d=google.com; s=arc-20160816; b=IcTjdQgoUKREoU1+Y/V7r3ATQAB+vnAM6YwDJMlIPyKQz5UNNMfSxV6s5LWpz2Ca86 3dGmQNq7hu1q6dUP1CxXtrQQUgVQpk0+IjfYJMxwZPaI76LweKIRe+00J/46IHWuyslm hQgYBfmkyG1pe2chF8VH3fVnjxD6MdcTBoVZKJAewg5AsYwQGkBbLKcIjrorDGH4nBz/ kz/wUTY6sxJap67pQeMkK7XYbLswZy4krC9Dxj8MNudAbzSg4Asqzt6iwve54eeTi0vm aMKNv1C4H4uM+S4/d6bW7dZB+NL01Kc0kWOp61qbySBeEXWcM4bA9345Ll6pLKDG+n4T WQTA== 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=U0QZIDyZGPbHoVggzc4W/OREfqHJwcTG/ZWH08UGPLg=; b=WnQP2LZHfg/YzPqwLCCD7laD2zZwdo4JcBNBmdOMUvuaTzDLsltqMrsIInzo2eFozX MT7neTF/BirRzzcSnyYV4jb8C6juWYWgKfjsbmz5sfuDBov/y77jIGKJpUfU9KiBUHSR ZoSsAW05aqbF5kb5EkkW1VYwWX4LgD08GvQZLaOM+G+ZYeu6LTZ4XZ0DuqRVJ9kOUnHc dAmFd2nEypricfEiG2Cq4vPgqUvSHtgH/w9S89q22Ag6W0bThYj7jm6Yc/RmIM1aDQNm xZgewDSaxl4+dh4M7A+GwXE5Pq3t7vm9Meied2QW7qxMoaC8qGVgeTJDU43q55MGoycY AXNg== 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 r71si11800wmf.263.2017.08.11.14.21.50; Fri, 11 Aug 2017 14:21:51 -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 2FE5C689B0D; Sat, 12 Aug 2017 00:21:37 +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 978F0689215 for ; Sat, 12 Aug 2017 00:21:30 +0300 (EEST) Received: from [172.31.218.31] (helo=vie01a-dmta-pe01-1.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dgHN7-0004wQ-Es for ffmpeg-devel@ffmpeg.org; Fri, 11 Aug 2017 23:21:33 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dgHN2-0005xj-50 for ffmpeg-devel@ffmpeg.org; Fri, 11 Aug 2017 23:21:28 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id vxMR1v0040S5wYM01xMSqs; Fri, 11 Aug 2017 23:21:26 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 11 Aug 2017 23:21:22 +0200 Message-Id: <20170811212123.22591-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170811212123.22591-1-michael@niedermayer.cc> References: <20170811212123.22591-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/gdv: Check available space before reading palette 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: Timeout Fixes: 2926/clusterfuzz-testcase-498711001458278 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/gdv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c index b324e4f26e..dc91869edf 100644 --- a/libavcodec/gdv.c +++ b/libavcodec/gdv.c @@ -427,6 +427,8 @@ static int gdv_decode_frame(AVCodecContext *avctx, void *data, case 1: memset(gdv->frame + PREAMBLE_SIZE, 0, gdv->frame_size - PREAMBLE_SIZE); case 0: + if (bytestream2_get_bytes_left(gb) < 256*3) + return AVERROR_INVALIDDATA; for (i = 0; i < 256; i++) { unsigned r = bytestream2_get_byte(gb); unsigned g = bytestream2_get_byte(gb);