From patchwork Thu Nov 17 20:53:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vittorio Giovara X-Patchwork-Id: 1461 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp999854vsb; Thu, 17 Nov 2016 13:06:56 -0800 (PST) X-Received: by 10.28.47.196 with SMTP id v187mr17898330wmv.75.1479416816435; Thu, 17 Nov 2016 13:06:56 -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 i2si4539658wjw.89.2016.11.17.13.06.56; Thu, 17 Nov 2016 13:06: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; 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 22F93689FFC; Thu, 17 Nov 2016 23:06:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk0-f195.google.com (mail-qk0-f195.google.com [209.85.220.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1FA8689FF1 for ; Thu, 17 Nov 2016 23:06:45 +0200 (EET) Received: by mail-qk0-f195.google.com with SMTP id h201so28230708qke.3 for ; Thu, 17 Nov 2016 13:06:47 -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; bh=JA++S5eF5MBO9Tz6z2qdxL9I1e36PFQY/mNrJxgoJxc=; b=Gr77Dybalb0iwx7fTzBZkNA86aRbGbhpN/LMyD39voVnM8wkdG54nu2FNn0iDlL3Ab s91EVGs9jILU4c92e1vXVcZX/9+ocY6GVg16LMAKDhqnYfc0J2BOEdSSk477V2Qe99cQ sfIhjDApPh/LAA8/ewZAHeCZdcBoKswRXoljWG85thPDDHHHkKAF+7F1foW0IWXJrgBP KLTCPCeXHEsOGyj/fX6akpfTSKzzeH4WTGtc85LUGr2kJ3Lxvnc3/gMAePe/g9dexcRz pU8u0faQvJVDuuIgNrNJTKs+Ath3uzZUTakXLS7gPae3dabiSATD2+PacYPgYQw1Rj7z Upsg== 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; bh=JA++S5eF5MBO9Tz6z2qdxL9I1e36PFQY/mNrJxgoJxc=; b=RI5rq6RfdQY22LjB3l54Qm3ArL1cFNSQULvWf5G89FOeWxnfG/FYrW+acQ6sZpDz5j h0jy6Ek+mXkkH4mZu+UaqAxr1PhLUCMpwgoGgySeInS1Cc+pmU+Q7bJ+xqoOJMKC73Ds NT8FkkBSLw89fJnJNJ2ZLCQALETtzbDE8hdfCReULakDk6NM6iWRp4ionlhVLd1c+GBa R51W8YUMZBERnc+j5WlE7LLlGdY7XKY1VhJ6ymXSA1vykxdwztPWwEB9xtGM6yDIQjyG oOtPiA4pDA6h1gP8Rk11d04AjGqV1p0F2OxAuqEgZTZtDGIqg8V2xHCOWSESZ9rDZS+1 D0Fw== X-Gm-Message-State: AKaTC00cB3PAKMmooecRf9CHsV0bpSDm1298pmkGzDVly+25vrnNrSBfuK/FzTGx+dVbtQ== X-Received: by 10.55.74.1 with SMTP id x1mr6357494qka.316.1479416000829; Thu, 17 Nov 2016 12:53:20 -0800 (PST) Received: from vimacbookpro.vimeows.com (nyv-exweb.iac.com. [216.112.252.10]) by smtp.gmail.com with ESMTPSA id w8sm2357407qta.25.2016.11.17.12.53.19 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 17 Nov 2016 12:53:20 -0800 (PST) From: Vittorio Giovara To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Nov 2016 15:53:19 -0500 Message-Id: <20161117205319.22796-1-vittorio.giovara@gmail.com> X-Mailer: git-send-email 2.10.0 Subject: [FFmpeg-devel] [PATCH] 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 --- Any opinions about this? Cheers, Vittorio (please cc) doc/filters.texi | 1 + libavfilter/vf_colorspace.c | 8 +++++++- 2 files changed, 8 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..5bc7b3c 100644 --- a/libavfilter/vf_colorspace.c +++ b/libavfilter/vf_colorspace.c @@ -168,7 +168,6 @@ typedef struct ColorSpaceContext { int did_warn_range; } ColorSpaceContext; -// FIXME deal with odd width/heights (or just forbid it) // 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 +1030,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(EINVAL); + } + outlink->w = inlink->w; outlink->h = inlink->h; outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;