From patchwork Sun Jun 24 21:18:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9492 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:141:0:0:0:0:0 with SMTP id c62-v6csp3392381jad; Sun, 24 Jun 2018 14:19:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfOoQ2oTWbI18m+Y744SQFIrIFX7YCCJ3B00Y3t1Z/Kb7nGq0rCuqvAq4DW0HHZRJPWG2jg X-Received: by 2002:adf:de82:: with SMTP id w2-v6mr8527726wrl.88.1529875161867; Sun, 24 Jun 2018 14:19:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529875161; cv=none; d=google.com; s=arc-20160816; b=fVXlXJu9iqaro6CtYJxcPt/vN8dJcX3B0aCjOL0ZAkgDW0A9FhpMkScodMnLtULJrz yJ/pTjT/P/h1nlD24+ryP5G4xqrVZN5MGAMTc7DzlZI4i2UU24McxUtAuVnuaRHZBPez YpZaXjxXuy0GdIzwv82WT2bIRPYqPJKOfTcL8FmSUPtC25qmi3qZQVslamDpiP6vCZP5 wUgarsvVdTwo29qeywr2Zm/aoWnaz0SSDiGFXuQ6xuVnXkyPV8AIvYqAuNSz7Je+UgHl OmeRLbRLOmIP6ofuK/0Ejv62IU+puAMmqi3DBE/uXkShuQXc8o5cEIL1mQFOCJlh+Ubs rBcQ== 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=ApwH9s8CFkWdlhHRtOThWia2BK9VMMBsbrL7Um1xJ4s=; b=osMUBX7ldjKP4pdGaFasr9S0FEfGFYywx6nlKPykYeOsu8dHHB1iO9tddTVtNpnev9 eMEJ531hbaKozNv0+N1ITLlTPkiV0zth2xMsqY6XPRrCyeNVQT+OdKnjGl8cnWzUHwSB xaKNIK8Q1mwssh14VmTjLVR+JdLYl17DGniAMnleb+RkOggCWHkBV+9V/xYW+V25e2QX iZiavgxzGzqccmj+sV6ymhVz1eg7KvgUEzx4yKk9rNhRQHQtFMyzFSMes57baWBeZZUK v+kRAGUDEC/h+E5E4OjNZpeh1sdip3UvThFy5FtQcyC46Ycalt1XRFNXZgtn81SHyz45 wUNA== 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 l1-v6si12137264wrm.403.2018.06.24.14.19.20; Sun, 24 Jun 2018 14:19:21 -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 E55D7689ABE; Mon, 25 Jun 2018 00:18:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-1.mx.upcmail.net (vie01a-dmta-pe05-1.mx.upcmail.net [84.116.36.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0256C689936 for ; Mon, 25 Jun 2018 00:18:16 +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 1fXCPf-0006yg-RF for ffmpeg-devel@ffmpeg.org; Sun, 24 Jun 2018 23:19:11 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 2lK51y00g0S5wYM01lK6TW; Sun, 24 Jun 2018 23:19:06 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 24 Jun 2018 23:18:25 +0200 Message-Id: <20180624211825.15682-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 Subject: [FFmpeg-devel] [PATCH] avcodec/escape124: Check buf_size against num_superblocks 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: 8722/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ESCAPE124_fuzzer-4843268402577408 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/escape124.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c index eb051eba54..33c67e7754 100644 --- a/libavcodec/escape124.c +++ b/libavcodec/escape124.c @@ -221,7 +221,7 @@ static int escape124_decode_frame(AVCodecContext *avctx, // This call also guards the potential depth reads for the // codebook unpacking. - if (get_bits_left(&gb) < 64) + if (get_bits_left(&gb) < 64 + s->num_superblocks * 23LL / 4320) return -1; frame_flags = get_bits_long(&gb, 32);