From patchwork Fri May 4 14:41:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xiang, Haihao" X-Patchwork-Id: 8779 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp101847jad; Fri, 4 May 2018 07:41:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZooeLgX6Hjw9uPvdoBBQMI2S7vxflwggnB7UO8rV1smtxMzKZDRplZ9nGFcMn6qzhf7AemP X-Received: by 2002:adf:c4b6:: with SMTP id m51-v6mr21914024wrf.126.1525444906406; Fri, 04 May 2018 07:41:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525444906; cv=none; d=google.com; s=arc-20160816; b=r34xyLOn/nQ3IZAUlwFTfVLXqOomOKCEEtIPwaOvaBtV4abgp+cJuHeaKzUMWWKj4h 3EtbVboKZslAgIqUhvPwnYpMT/ViK2IYWPLhHYsun7X9HU10qxeFYMZeAwJx12iOeKK6 gVL/7qNGo2xCqTmSibFgR/l+cWuVQszQh7qGIFlYoqtNzIq5YlfpQm/qlHlJ3pyqUmBQ zz3En7d/Oc4HUvL1IndL36k58tm9uyi0JOXHCCNCzVJg+LyW9muPa2PLVaz01U5PFWYj c5VtOTKMcwd+nsMdL6vRwZPiK6WlWfZcou9+E6ZxfN/0y6tQ0dvYLfPEsLovbuINv+n5 /Wpg== 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:cc: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=j0fbZMc3VU5DO1d+tWtg0smSfqD2YD3F5bsJikl9gnM=; b=eKy81XfYeGI7a5ETOwphnf+3vINTH6a2kA8syD0lhJlwieRjPH9cl5HIW0loVvNk9k pHocPauKl/k1bLKTTyFh6kW8wuEfbYsjDnY68pN0uc5lNdXichZKEMpHiPXYwMlFsBiW H26mezqKWnW3iNCI7qzOkCkYCLuOvJF/8PPELXt88PTQkSZ3r974uaUw6kNfRgcfCGyi zCK0pBzz0DrxhkM5Y5rS2sm4EgicNrxbzo78uhAQo6kFW1VrxYQ2OiOivhPk0VKFvZCX FpP2rpfQw2ySQDO70ConoABjOAgSlewmDjEmzgPPvKPX0DRVHDXoV0BOwOZDjX69Ingx 9ZRQ== 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 j28-v6si14312766wrd.393.2018.05.04.07.41.46; Fri, 04 May 2018 07:41:46 -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 40FA068A5A7; Fri, 4 May 2018 17:41:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4795D68A5A2 for ; Fri, 4 May 2018 17:41:04 +0300 (EEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 May 2018 07:41:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,362,1520924400"; d="scan'208";a="38686673" Received: from xhh-skl64.sh.intel.com ([10.239.159.70]) by orsmga008.jf.intel.com with ESMTP; 04 May 2018 07:41:35 -0700 From: Haihao Xiang To: ffmpeg-devel@ffmpeg.org Date: Fri, 4 May 2018 22:41:06 +0800 Message-Id: <20180504144107.16201-2-haihao.xiang@intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180504144107.16201-1-haihao.xiang@intel.com> References: <20180504144107.16201-1-haihao.xiang@intel.com> Subject: [FFmpeg-devel] [PATCH 2/3] hwcontext_vaapi: Return error if can not find a VA RT format 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: Haihao Xiang , Mark Thompson MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Otherwise va_rt_format might be unitialized Signed-off-by: Haihao Xiang --- libavutil/hwcontext_vaapi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 7daaa951cc..e59042487d 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -1028,6 +1028,11 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst, va_rt_format = vaapi_format_map[i].rt_format; } + if (i >= FF_ARRAY_ELEMS(vaapi_format_map)) { + av_log(dst_fc, AV_LOG_ERROR, "No matching VA RT format \n"); + return AVERROR(EINVAL); + } + buffer_handle = desc->objects[0].fd; buffer_desc.pixel_format = va_fourcc; buffer_desc.width = src_fc->width;