From patchwork Mon Aug 13 00:24:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9968 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp2578088jad; Sun, 12 Aug 2018 17:26:03 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwUg4UiBejpo70jQMqpgiAEM5QqlYEl+8iPZ6RVwxe7hzcopR09XHpZU0OGcBcMUqkoyZUn X-Received: by 2002:adf:f390:: with SMTP id m16-v6mr9348148wro.279.1534119963509; Sun, 12 Aug 2018 17:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534119963; cv=none; d=google.com; s=arc-20160816; b=HknO9zAR2pIDfLgbfsAP1P7ohqCzQygeApzVDZikMTJ1d3Ho9p3C6EqfaQW6fZ99GD O/j1ZTDQTN8BjMXV0qztHrH3sdMDm9Wop+Arwy2ZkjF+WE3QBuaUGUav9KSyV3Rvf5Ni 5rHQcTnbxZNfDySeI4vycZ3a2D5PWa36FXMTw3Fhi3zjS1lzSprShfV0daJQidPTX0TR y5D+q01rnwlsYvXfpzvDFVnuPVJihVs0rapT63ktGMIXLL51HDa9SGHREqGD7HIHMSZJ QbVbz5SR9He53ZxBpt9NApsPvLpg4DisX/IWz6DmcF+tniueLZWHsdvOe+Z+lNLIkSb/ jBIg== 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:arc-authentication-results; bh=WJtlpx9RM611yg0QMN63QaGpy62ww11paYo9+xdjdf8=; b=LYrcekxcafyRSz+IZ5jslQbOj2MrVrE3DHC9Sb6EGbEYP1etKzrL7zyLGiv9P0I+uR 1eu06oZLU0sgtU4W8uS6/th3DREzgfp4EbJazwPSLaQ7KG4I3q313rhtc2yWt+se5zNA v2eOKdLiRSWfWSqDDEhVJIraOipy5QcIX3SheQByK1MRqoCA2ofnlV3vMBbZLDfFLIky Q1OzUK9w4SmXJQlePZ27a0Tqv8me6tSL4d4ufoZMtsn//4CL+S3p4e4+OCU+6TywG/uH R0ajQrwfdQU2AFe593gxONrctihVteEWVIL33okMh1Onhmh7BJ1dtKzBUucO8gFdzj1E uzUQ== 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 m2-v6si5430418wmm.185.2018.08.12.17.26.03; Sun, 12 Aug 2018 17:26:03 -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 C011A68A5F1; Mon, 13 Aug 2018 03:25:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-1.mx.upcmail.net (vie01a-dmta-pe06-1.mx.upcmail.net [84.116.36.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E475168A58A for ; Mon, 13 Aug 2018 03:24:55 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fp0fe-0008EE-RH for ffmpeg-devel@ffmpeg.org; Mon, 13 Aug 2018 02:25:18 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id NQR81y00q0S5wYM01QR9oD; Mon, 13 Aug 2018 02:25:09 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 13 Aug 2018 02:24:21 +0200 Message-Id: <20180813002423.10292-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180813002423.10292-1-michael@niedermayer.cc> References: <20180813002423.10292-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 4/6] avcodec/lagarith: Optimize FRAME_SOLID_RGBA 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: 9484/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LAGARITH_fuzzer-5707859156271104 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/lagarith.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 510a6ff2d6..b9a0649c31 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -572,8 +572,14 @@ static int lag_decode_frame(AVCodecContext *avctx, dst = p->data[0]; if (frametype == FRAME_SOLID_RGBA) { + int w2 = avctx->width>>2; + uint64_t c = ((uint64_t)offset_gu << 32) | offset_gu; for (j = 0; j < avctx->height; j++) { - for (i = 0; i < avctx->width; i++) + for (i = 0; i < w2; i++) { + AV_WN64(dst + i * 16 , c); + AV_WN64(dst + i * 16 + 8, c); + } + for (i = 4*w2; i < avctx->width; i++) AV_WN32(dst + i * 4, offset_gu); dst += p->linesize[0]; }