From patchwork Tue Aug 31 18:33:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 29930 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5179969iov; Tue, 31 Aug 2021 11:40:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynNKh7o+UMLKGDxl1a9PheiGpMSwrcIavtopnBXAuSbpxzoQ8I+GpiWSq7W0RN3GuHTooB X-Received: by 2002:a50:f0d5:: with SMTP id a21mr17353930edm.244.1630435222680; Tue, 31 Aug 2021 11:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630435222; cv=none; d=google.com; s=arc-20160816; b=vn2qbuW2bdejQ3t571pnj2Ow1UVQddQQxhUsIQq2CqX3pUl0pWFLy/b2pJW7A1CgRz 9sjjII59wDJI/q5RYoJgljsJcY+16U09CK9uzgEIAbQ9Wy5buLsOCzg3WlJvIMO4DhzG zBd/jhdG+gl+ZVFV7B3Tq7eqmHaDa96MwCV/1X1G6hPJ0zE9lELuIl08xnHiqb3K0A8p loEyRYBDOts8xWrrSfwAvhGEmgbwDC3Dev7Wlfsbwdv+t8PWC0SnoiYerQbxQxdCrMin ysZbzcTgC3UMSQeuBqRL489KtLrP+GJjEmUuQ/arsscWteQWrtA9vMgmL8m/Ubtqe67/ /cVw== 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; bh=Vie94OqPuwmf3hqNRpW7OD1nfm0iJ38/p+sXkjiypG0=; b=QB24kEoRyRYnI2DKrrPSLvb8NmxKayI9sXZ87WDniltPFMydYe5qDg+SEN3gLkyKjS 25Gd4/QVK7/MJ9KPEaR62R6TUo45RW+OAoDERVq+3agk4MyGOhumfvJrdMUywV83wIes KCgYmush1bqgY9Ha6NtjnITW+JJIRDAvojQU9BzbwlKLZozhtWERiCaQ5K+caKeQUupZ /7zcpOtgyNLGrSYZoCMHN8HGoiEhn65+m98VI/29dhhQFYWeqMQH8JvJx+RMQPwfDHPq sWlhjKC8x1Nz1OAWf4WmhGm1/Qg3yo3f6P53NHel/zV1nbN1en3AzyADtNos/dlPvYR4 mxSQ== 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 k5si279211edr.133.2021.08.31.11.40.22; Tue, 31 Aug 2021 11:40:22 -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 0B5B868A2D2; Tue, 31 Aug 2021 21:40:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-2.mx.upcmail.net (vie01a-dmta-pe03-2.mx.upcmail.net [62.179.121.161]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EC05C6809E0 for ; Tue, 31 Aug 2021 21:40:13 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1mL8ap-008jZW-0G for ffmpeg-devel@ffmpeg.org; Tue, 31 Aug 2021 20:34:43 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id L8ZqmkqkUljeHL8ZqmplUR; Tue, 31 Aug 2021 20:33:43 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=BoHjPrf5 c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=my47eFXueJ_DgFcvEyIA:9 a=1fhp2MxaeJtTNGEnv6mo:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 31 Aug 2021 20:33:41 +0200 Message-Id: <20210831183342.3268-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfCnuU8m8uWbgWExa5TzjbyJBcWyjEwmveZ63JSFsaXEFR/JLxV7zTEPLSeupgkeQgE3nCrbFLKVu65kJWodif6BVtsPLOBo3blauDYGE+5t0A09qTIe0 AEC2O4OmJ3of9sPZg7645aeAp9Pqvq3DCTqENKDXkxF+6wYe6eHw44BC Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/pictordec: Optimize more odd cases for picmemset() 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: AWCiJljmcN5C Fixes: Timeout Fixes: 36875/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PICTOR_fuzzer-4842960888922112 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/pictordec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index c37c5e7106..c7b3a335d3 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -89,8 +89,7 @@ static void picmemset(PicContext *s, AVFrame *frame, unsigned value, int run, d = frame->data[0] + yl * frame->linesize[0]; if (s->nb_planes == 1 && run*pixels_per_value >= s->width && - pixels_per_value < s->width && - s->width % pixels_per_value == 0 + pixels_per_value < (s->width / pixels_per_value * pixels_per_value) ) { for (; xl < pixels_per_value; xl ++) { j = (j < bits_per_plane ? 8 : j) - bits_per_plane; @@ -98,7 +97,7 @@ static void picmemset(PicContext *s, AVFrame *frame, unsigned value, int run, } av_memcpy_backptr(d+xl, pixels_per_value, s->width - xl); run -= s->width / pixels_per_value; - xl = s->width; + xl = s->width / pixels_per_value * pixels_per_value; } } }