From patchwork Thu Nov 17 21:09:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vittorio Giovara X-Patchwork-Id: 1462 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp1004182vsb; Thu, 17 Nov 2016 13:16:08 -0800 (PST) X-Received: by 10.194.87.230 with SMTP id bb6mr4001547wjb.163.1479417368874; Thu, 17 Nov 2016 13:16:08 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b79si12968220wma.103.2016.11.17.13.16.08; Thu, 17 Nov 2016 13:16:08 -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; dkim=neutral (body hash did not verify) header.i=@gmail.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; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D495F68A032; Thu, 17 Nov 2016 23:16:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt0-f172.google.com (mail-qt0-f172.google.com [209.85.216.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8BF6E689A55 for ; Thu, 17 Nov 2016 23:15:59 +0200 (EET) Received: by mail-qt0-f172.google.com with SMTP id p16so142211569qta.0 for ; Thu, 17 Nov 2016 13:16:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Tv7XGTofYHt8rE/yVCN17r1liEGx4S79wS5zazlvTIM=; b=T/dJPt1vJSfkh3YtLmtyC4Qi/eJ2Bb9ZM1xiTmoJXjdfOMDjFZjoq9jUfNwyZxQx8K w2Q54mOklw+un9KmhwBwFfLxpfbmVw1CWZShNxQTK3DxR4mMyILoA/S8B2KZH9+lySYz 6yCH5CN1eLuuH1ifP5dk84I91uBZ3eQ1mTrW70Qbx9dzoYQioyPVoPeenFwiUQY5ssf3 FcZsd0rKlLVR3gytnegJh7fOOy7rNoiPhBiMlLhzLxQGh24tT1Kokptryf7gjCdXP2/h qEiX1pIDE7okqwpo1vi7PvjgShHvlod+Hov22NexGgWwTXV4Wym3gEmsy77+2OUU2O+o 1CZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Tv7XGTofYHt8rE/yVCN17r1liEGx4S79wS5zazlvTIM=; b=MsTueHjWH11j0T0HZVBVOFncfK1EoBHQ7wb9ZthXGrryEtjpFO3O/yuYqRCQY4VU4U WG7KIKEa+4e+dpcEtAqQHZ7sufRiqDoaPeMP5rokTEjeu/56qlDTtggevRr0UQfnM5GG M/T8e1XBNn0ew/DhwkQ8ll+OR/tWblorfFoWFbxqaJVmPkGki5xyv5i8E1jm0VMTUUn5 ecUc5VI893VaMjlyPgxGALSMJgt6funD855NVqsH51JzvJVB3KYOgWWxdi+cH+RaDuv6 xkiHRy/PwrNQyL/amaEmZ3OYlKIX/lnBWnZkRJ+7HLGyFDSV0FJqam1tIp5fEfcsYPPc OhOw== X-Gm-Message-State: AKaTC02644W1B0UiEZcFp52U6UMgMmSTqbsn07l9sF7LBP+4xor/AAr5T/g0W/xQSv3OyQ== X-Received: by 10.237.59.186 with SMTP id r55mr3759981qte.22.1479416963649; Thu, 17 Nov 2016 13:09:23 -0800 (PST) Received: from vimacbookpro.vimeows.com (nyv-exweb.iac.com. [216.112.252.10]) by smtp.gmail.com with ESMTPSA id 1sm2370382qtb.49.2016.11.17.13.09.22 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 17 Nov 2016 13:09:23 -0800 (PST) From: Vittorio Giovara To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Nov 2016 16:09:22 -0500 Message-Id: <20161117210922.24484-1-vittorio.giovara@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: References: Subject: [FFmpeg-devel] [PATCHv2] vf_colorspace: Forbid odd dimensions 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 Cc: rsbultje@gmail.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This prevents writing past bounds. Signed-off-by: Vittorio Giovara --- Updated according review. Vittorio doc/filters.texi | 1 + libavfilter/vf_colorspace.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 208be42..aee43a8 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -5278,6 +5278,7 @@ colormatrix=bt601:smpte240m @section colorspace Convert colorspace, transfer characteristics or color primaries. +Input video needs to have an even size. The filter accepts the following options: diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c index c7a2286..0024505 100644 --- a/libavfilter/vf_colorspace.c +++ b/libavfilter/vf_colorspace.c @@ -168,7 +168,7 @@ typedef struct ColorSpaceContext { int did_warn_range; } ColorSpaceContext; -// FIXME deal with odd width/heights (or just forbid it) +// FIXME deal with odd width/heights // FIXME faster linearize/delinearize implementation (integer pow) // FIXME bt2020cl support (linearization between yuv/rgb step instead of between rgb/xyz) // FIXME test that the values in (de)lin_lut don't exceed their container storage @@ -1031,8 +1031,15 @@ static int query_formats(AVFilterContext *ctx) static int config_props(AVFilterLink *outlink) { + AVFilterContext *ctx = outlink->dst; AVFilterLink *inlink = outlink->src->inputs[0]; + if (inlink->w % 2 || inlink->h % 2) { + av_log(ctx, AV_LOG_ERROR, "Invalid odd size (%dx%d)\n", + inlink->w, inlink->h); + return AVERROR_PATCHWELCOME; + } + outlink->w = inlink->w; outlink->h = inlink->h; outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;