From patchwork Wed Jan 11 23:54:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 39983 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp5132633pzb; Wed, 11 Jan 2023 15:55:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXtzYKGZNhT5b/UJeft7T1j28s8EuseYcXLb2oxZRsTgUXKgTg3O0UmE3gmJ0cZ6jxxDC662 X-Received: by 2002:aa7:d752:0:b0:499:bcfc:f47b with SMTP id a18-20020aa7d752000000b00499bcfcf47bmr9898548eds.16.1673481319242; Wed, 11 Jan 2023 15:55:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673481319; cv=none; d=google.com; s=arc-20160816; b=GzQ6AbXrE2nCZfO/k7h4BFw4+1wZEJU/J9Z1IFXwN7zshzmhhzFxl8L5XaoheEFqjd DX44iSWlMKlH/Q3mgisek7J/EGTfN5fnEwBNWMj3WE6Ii2v4n1qOBYlAj5TT7W1UrwDY WFO4ipYyy4yPOulLwjhZ1UoWxc0+fS/KVwY8KHJ7fVRntlkgVdDj4q9afcCYfFOy5kny a3sjSoN+WXoiGTG95p7lArEZKEkmWwhdol4JxS3JezBlVdBB6dTwEQ+fW+cpjjY7IJOD b0QUL9FdOl7tErEFLvsBxKn06ZNlPZDor3DMiL6hRO8F0tA+VDuEwIyPl555kAa16Qwj LJBQ== 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=B4wigN/jJleh1nrLwEOzUZj0l8lZvRZwcRQPH29h/a0=; b=CdOHTv/32p0MtojeixfgT4sXMW4V3ssVYR25m5xmMKzdq2dAwmi4bP4moTJNOKLeAA 4BU0pJp+ue6Y7msqnak5ozh5gjlJb4aky99arXtuqcXz/fuaAW5pBBoLvHF0Pj82bAQ8 9rvW0NE8k1Uq4OSkD9BLw2XyNwwg8B11ukkE6SiT5bBWLcTkYtM57I06CGT/Fl32u4Jc Ooaq3vmcSxbyn2UL5l/rhCQGpu4ojroiNA/DumbISenIYqtU91bwqdlEZEIIRzGI+pKr rnE1s71zANs7chvSGr+FoXOnq4XXwU17Z0HTdRfYGrry8Xw3pQbD1dT3ExA3ULcQ93yp /1Vg== 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 d22-20020a056402401600b0048ef8cd7fe6si16481017eda.185.2023.01.11.15.55.18; Wed, 11 Jan 2023 15:55:19 -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 5501A68BCE4; Thu, 12 Jan 2023 01:54:46 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E7B4368BCE4 for ; Thu, 12 Jan 2023 01:54:37 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 43442240007 for ; Wed, 11 Jan 2023 23:54:37 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 12 Jan 2023 00:54:31 +0100 Message-Id: <20230111235432.2135-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230111235432.2135-1-michael@niedermayer.cc> References: <20230111235432.2135-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 5/6] avcodec/videodsp_template: Adjust pointers to avoid undefined pointer things 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: IjTIAPFWsp+X Fixes: subtraction of unsigned offset from 0xf6602770 overflowed to 0xf6638c80 Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-495074400600064 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/videodsp_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c index 324d70f2cb..d653f4d524 100644 --- a/libavcodec/videodsp_template.c +++ b/libavcodec/videodsp_template.c @@ -64,7 +64,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, av_assert2(start_x < end_x && block_w); w = end_x - start_x; - src += start_y * src_linesize + start_x * sizeof(pixel); + src += start_y * src_linesize + start_x * (ptrdiff_t)sizeof(pixel); buf += start_x * sizeof(pixel); // top @@ -87,7 +87,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, buf += buf_linesize; } - buf -= block_h * buf_linesize + start_x * sizeof(pixel); + buf -= block_h * buf_linesize + start_x * (ptrdiff_t)sizeof(pixel); while (block_h--) { pixel *bufp = (pixel *) buf;