From patchwork Fri Jan 13 00:01:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 39992 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bb05:b0:b6:a58c:cef with SMTP id fc5csp62748pzb; Thu, 12 Jan 2023 16:02:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXv6yN8xPJPi+w1OGDGJKJFCnnaOGqQ1b2jAZwCI79grPc6roXoyY/IXBCp+G/A+ygUxCMh5 X-Received: by 2002:a05:6402:2b87:b0:482:4ffd:3e80 with SMTP id fj7-20020a0564022b8700b004824ffd3e80mr57822276edb.12.1673568143149; Thu, 12 Jan 2023 16:02:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673568143; cv=none; d=google.com; s=arc-20160816; b=u9zD+TGI1WXqazyPSyzZv+NV+bQZJ3TPyXRi3SBMtlyfqJFQMePKYH5ZERrQH9/b3C iRe/1zDQCXbVJJnNjniiR8FKcwBdKMqda61uso5dWH2Im30ktG5Uaf6s5BHVfQSxMYNw nWEXW4KoVasAQNF0CupA6eAjupzMGMmzFdH5ePMb0+Pb9gkNlkpURmvPro/fl1Sr85MP +pqoYq9MMTYGps+fiWJHonQrAY74KKO7pUW4T57v+2sYpp1tbAlGZumVexkODmDZrY7R l+PASIvMpGUlyzo7VhcEVTMvUXmd3c/lKrT6HjgeLph2/JtKBQazc3fR7Vqphp3AyAn5 Ptvw== 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=XB9IYhGqjhdBu81KVPFffNQ6f9eGcTUrtCBhqB0ZffI=; b=qgkCDh6KhD2xSV8szJHvtK3MUSkqN5UoSMcTsVCaIAQNkMzUK1kD8iCJJAp1lxbvHL cPTdi8usgCiDlVVJ/D3mVDbE54M5SopAYYmSiqj84I8udTFhkI/c9xMR4AOxEnygCv+G D74bhqJ0OQ/vIj3sMdVxNxkeNzuzBOMFEo5nBi9Ot7oDG6QfO835uewjZc+v7vjgTOHr euM3PnSgCulbHrAg3kB+5mZFYox0+qgpunnydYrU5yaYIN2NIkwgKq1P+xLMfohkKvhF Yaty+5HKISrhDncaS9o/bW9rXe8EgAtWh9y7JOEvMl5jVGLYwPsDgoosI48z4ADS1QRl I3zQ== 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 cs10-20020a0564020c4a00b00499cf6bd2fasi8222435edb.66.2023.01.12.16.02.14; Thu, 12 Jan 2023 16:02:23 -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 75B9C68BC9D; Fri, 13 Jan 2023 02:01:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DA789687F61 for ; Fri, 13 Jan 2023 02:01:41 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 3BE8E20008 for ; Fri, 13 Jan 2023 00:01:41 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 13 Jan 2023 01:01:36 +0100 Message-Id: <20230113000138.9994-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230113000138.9994-1-michael@niedermayer.cc> References: <20230113000138.9994-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/012v: Order operations for odd size handling 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: gIvjUfllKMk3 Fixes: out of array access Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ZERO12V_fuzzer-6714182078955520.fuzz Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ZERO12V_fuzzer-6698145212137472.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/012v.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/012v.c b/libavcodec/012v.c index 2d89a86b98..f0197cd8f9 100644 --- a/libavcodec/012v.c +++ b/libavcodec/012v.c @@ -131,8 +131,8 @@ static int zero12v_decode_frame(AVCodecContext *avctx, AVFrame *pic, u = x/2 + (uint16_t *)(pic->data[1] + line * pic->linesize[1]); v = x/2 + (uint16_t *)(pic->data[2] + line * pic->linesize[2]); memcpy(y, y_temp, sizeof(*y) * (width - x)); - memcpy(u, u_temp, sizeof(*u) * (width - x + 1) / 2); - memcpy(v, v_temp, sizeof(*v) * (width - x + 1) / 2); + memcpy(u, u_temp, sizeof(*u) * ((width - x + 1) / 2)); + memcpy(v, v_temp, sizeof(*v) * ((width - x + 1) / 2)); } line_end += stride;