From patchwork Wed Jan 11 20:42:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 39975 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp5037961pzb; Wed, 11 Jan 2023 12:42:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXsRT1p4q4bMo02wT4EzrbqNcMuETay+whQEgPhja7ZsjCkCuTDV/LuSMLmD/pfwhg4UDRiP X-Received: by 2002:a05:6402:381b:b0:497:233d:3ef4 with SMTP id es27-20020a056402381b00b00497233d3ef4mr22871205edb.22.1673469776448; Wed, 11 Jan 2023 12:42:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673469776; cv=none; d=google.com; s=arc-20160816; b=XfcGV+4AdCnz0N+FDVmapfNhMJXCZky65z87xXDDXMlKGRl4z2a5zjdYcXeLtVLPe3 CaowNaC+KsWEzID2xUbs29VtiK6GSEumYUNXM3lPMQRMTC821Uw6lr/X0Xjquy2LQ+wG u4Yv4uRQDE34ckWmlQg064wI+2SAFmhR0a/yOX1cGOr+RQXO6OVxcudLorsT0wIRpXZy Ak6tsEfx4qIV4UoJJyYwwzLU0v2l1/6Jauaja+jkLKi83apLlkRXE866R3wetYkfrUFK vcHYRWZI7xuDS6yR+uxV/NJte2AW9oTyNZqUOP/ht1sa5xZv8ff1sY6PrFQ7fbdVbq1A Xv6A== 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; bh=sr0XK4NPLh6TZGtP+ai+8sAc4Bmbn50/drZI0E07eIA=; b=jGraKP3ulwbgYphSJPRy+o3bQMIrc54QSNywrShEbm+zg6pQY1NP0faDYVnTmCKvRk 9t8StNhHLfApB4p7IVhfPXepm2GZRCBfURXIPWHI9IyUhowci5q1jYpQ6oTlQWh5Yp0k xDpDQI5mGtzGSCuCAPSqZ2Od+lEMelTNnQXkSwWW82msyS2FigkUVmgZ5EeN4x2Y61+x 4faLeBQ6cMVsI2D6562ThqX8XNxR4KTGYCx7QEgtpMp+GIIGVCYpyhZPAcGZmUeIvR1F LqqWj2BGxM1wEFTrrCsXfW3XyrvXB48DlGiLYfmNyFvuqEkvOnxcGH+ZZNFOy27IFMbq i3oQ== 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 b8-20020a056402350800b0048589250850si17548431edd.11.2023.01.11.12.42.53; Wed, 11 Jan 2023 12:42:56 -0800 (PST) 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 76C7768BD5D; Wed, 11 Jan 2023 22:42:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B5E5668BD23 for ; Wed, 11 Jan 2023 22:42:31 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 8487E1C0002 for ; Wed, 11 Jan 2023 20:42:30 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 11 Jan 2023 21:42:18 +0100 Message-Id: <20230111204221.22550-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230111204221.22550-1-michael@niedermayer.cc> References: <20230111204221.22550-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/6] avcodec/bink: Fix off by 1 error in ref end X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: dlBI2EEuuZRX Fixes: out of array access Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-6657932926517248 Alterantivly to this it is possibly to allocate a bigger array Note: oss-fuzz assigned this issue to a unrelated theora bug so the bug number matches that Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/bink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index e3971e557a..a3140114f0 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -870,7 +870,7 @@ static int binkb_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb, binkb_init_bundles(c); ref_start = frame->data[plane_idx]; - ref_end = frame->data[plane_idx] + (bh * frame->linesize[plane_idx] + bw) * 8; + ref_end = frame->data[plane_idx] + (bh * frame->linesize[plane_idx] + bw - 1) * 8; for (i = 0; i < 64; i++) coordmap[i] = (i & 7) + (i >> 3) * stride;