From patchwork Wed Jan 24 20:51:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7413 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.156.27 with SMTP id q27csp1221911jak; Wed, 24 Jan 2018 12:51:56 -0800 (PST) X-Google-Smtp-Source: AH8x226Qtsh/W6xI9ihlG6zxtXTmbxjNck6/01lGykI6vSNLTgtUou2M2usiUvHacyEHDXwc2yRD X-Received: by 10.223.171.194 with SMTP id s60mr6836706wrc.250.1516827116380; Wed, 24 Jan 2018 12:51:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516827116; cv=none; d=google.com; s=arc-20160816; b=tbEXDGJ1PoKtbdlISwrg41kXvXh5XDRK7L7GisbFEYzeGWV8X90TFd64ZD+gvCJNuo JGfylzZA8rcGb+yKhmtnCkLP8kwx06TaYPiSphkgQ8pxODbIZ9e2YHsVrXonbyRerGnd fBG4F75Lhp04gt+WmuD7qfGppOxY5wlvK4qUmwjwYBBK00n/vm9jYiBzc3l19eK8FZdy BtbnChQU1CnQhA4ys+bHivsHChk+44BLYdLzO2GZf5toizlbHHp9viiXRJ6DLN168hMS UG+1d8Y1fas/TE2wsL/0Fq6dfSxQ5PyEsPbeVKsiZpncWBLlKzKnkrpAzs1p1PD3JqFZ gi7g== 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 :arc-authentication-results; bh=Sorppyej99cXlW/tK25crpjXLUaOpxsZGWaRt7KUTK0=; b=ykyI1B2X03zhrVVBDYg2XWvIlyFiazE5FF+j+DltD+MSXJyKsQsx5btU2ol8irMzNo 7/0hAVppRdXrEtpfsNIMVeR5JsFTJ5BTD9sUTIwyA1iBn4bqbt52N9owdlfhAtjovQ9A 50ea5cejSChvaRtp9iwWIIyEWImErAVPIjjQnZTjCEk/yslDJitxr5brYZC9E5GZjVmB U2OOhQXyVt/gCIZG2Z9dVUadmnKtlVK1KZTue31goCySxv9hRucHJLv3LyritBoI14Tb U7oXrtX2NBVNg3DQ9/suzqKJmQSBnCaIIbHs6nFFViUxQO3CPVA76xDym2plxbx+9ALh 8eMg== 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 u17si644258wmu.270.2018.01.24.12.51.55; Wed, 24 Jan 2018 12:51: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 35A4168075B; Wed, 24 Jan 2018 22:51:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe01-3.mx.upcmail.net (vie01a-dmta-pe01-3.mx.upcmail.net [62.179.121.156]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0F5B86802BB for ; Wed, 24 Jan 2018 22:51:44 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eeS1K-0005lJ-S7 for ffmpeg-devel@ffmpeg.org; Wed, 24 Jan 2018 21:51:46 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 2Lrj1x0170S5wYM01LrkKf; Wed, 24 Jan 2018 21:51:44 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 24 Jan 2018 21:51:42 +0100 Message-Id: <20180124205142.30000-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.15.1 Subject: [FFmpeg-devel] [PATCH] avfilter/vf_transpose: Fix used plane count. 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 out of array access Fixes: poc.mp4 Found-by: GwanYeong Kim Signed-off-by: Michael Niedermayer --- libavfilter/vf_transpose.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c index 982fb0c8ca..1e1a5c4b89 100644 --- a/libavfilter/vf_transpose.c +++ b/libavfilter/vf_transpose.c @@ -27,6 +27,7 @@ #include +#include "libavutil/avassert.h" #include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "libavutil/intreadwrite.h" @@ -54,6 +55,7 @@ enum TransposeDir { typedef struct TransContext { const AVClass *class; int hsub, vsub; + int planes; int pixsteps[4]; int passthrough; ///< PassthroughType, landscape passthrough mode enabled @@ -215,6 +217,10 @@ static int config_props_output(AVFilterLink *outlink) s->hsub = desc_in->log2_chroma_w; s->vsub = desc_in->log2_chroma_h; + s->planes = desc_in->nb_components; + + av_assert0(desc_in->nb_components == desc_out->nb_components); + av_image_fill_max_pixsteps(s->pixsteps, NULL, desc_out); @@ -272,7 +278,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, AVFrame *in = td->in; int plane; - for (plane = 0; out->data[plane]; plane++) { + for (plane = 0; plane < s->planes; plane++) { int hsub = plane == 1 || plane == 2 ? s->hsub : 0; int vsub = plane == 1 || plane == 2 ? s->vsub : 0; int pixstep = s->pixsteps[plane];