From patchwork Sun Jan 2 14:51:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, Jianhua" X-Patchwork-Id: 33015 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp15456146iog; Sun, 2 Jan 2022 06:52:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJweqvS23dEh2u0OIRn9DTCViWkQwwUnMmLvGLvqOYkygCPdRMj5tUi70LTqkCT8m2wlICkt X-Received: by 2002:a05:6402:50ca:: with SMTP id h10mr31112824edb.331.1641135170705; Sun, 02 Jan 2022 06:52:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641135170; cv=none; d=google.com; s=arc-20160816; b=yG/am3P6YAhvyhB7Lh4tNDfj7ItP8HOgbO4gOMgfQloRhaoSIbjZkOlzKAfuHnNWcr BpkppRrwovYc6VrfPBy7PNMwrSQXm4O5le3f2VlzNQaFsO8kVaeg2OwDV30At6lHn7BH qrZJbbITheGUsAnAgI8lE6aJD7pB3LHd7Afp16r0pXWkWNk6zoIRpO6X6UasbxwnSJy3 OVh3Aiqv6Ps7sUoitXEzjhawhS78TQuFbA+J0LSTbUoUs8mg+N7tZyNIvqdHr/r77dij CX2Q/0sN69L9IjbQY2Dfp7f7BlMGGc6hSr5BVkTOd7rx5yxDgb4WzsySZP/iHR/ctAUj 5tEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=D83h1KTm4aMQzFAJAVXwRPL5ETGt4FCghf7arfKrIE0=; b=l4gwQUxXOr16eZv6CQCRzbCtclCAa9aRN9T4P3yq/vsTz9iIcSVYxBNm4j0ORgFbp/ /hAD6N+B8IE5C7Og4xb+f7QQxmKYqk2sGtvhYbfx+83kC0142khBuVkQzvULpo2URREA jQZbQ7Fn1mH7X8iiscNmucBgi9R8S2Fpx8LSmo5UfU9FwJ7EcRvP4xtiF24obNJPyVU1 EEo3xO9zKxEWZIefPe2glZ+IGNQH0v6gJ82om4vPEZc4k6aoLluTWUxMHZU5aojZaO88 9DaaPokkDEZEku7ckphSMj6u4xftmPSvCBLbJ1V3Vzca3MFS2EtaWycZ5rQdYKKnpHGH 6i1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=JCbbaP+V; 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 cq4si16027460edb.52.2022.01.02.06.52.50; Sun, 02 Jan 2022 06:52:50 -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=@intel.com header.s=Intel header.b=JCbbaP+V; 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 CED4768B178; Sun, 2 Jan 2022 16:52:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 37DBD68B16F for ; Sun, 2 Jan 2022 16:52:11 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641135136; x=1672671136; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tWZJ7PgKT3cYAbas2CjemCgv5HqU94xSL1MoB+/ksqk=; b=JCbbaP+VS5MkRnGXkxRhjQ7/wOIzPNBa9omzZ4BjsV1ogXtLnF67diMw 6zbt8xrRMvHluA9vmb854ZlsA2HcQ0BO36oJUkKndabh+IoeSddkAmPrD wEplFyVUJtXXR031Ug6yuMI2DfJkyZU09jbDIzufw7sSccf2Vg+jYGPXC jWd9pSuQW1FLp8otRU/8BYE5e+oXDW18+30vtC/weJgFD7if2se+iDZyK TMHVBLGVHwxO2fzwVMJB7gMKqyQxWf3qKPDby9034IF5tU8p8jySyJqHq crgpMYUbMaEdinHta0rUBPByrCVgu63GUTWmK/LAppnFAmuPL/ubbdB4Q Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10214"; a="221966003" X-IronPort-AV: E=Sophos;i="5.88,256,1635231600"; d="scan'208";a="221966003" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2022 06:52:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,256,1635231600"; d="scan'208";a="667176325" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by fmsmga001.fm.intel.com with ESMTP; 02 Jan 2022 06:52:05 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Sun, 2 Jan 2022 22:51:42 +0800 Message-Id: <20220102145142.4083918-5-jianhua.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220102145142.4083918-1-jianhua.wu@intel.com> References: <20220102145142.4083918-1-jianhua.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/5] avfilter/vf_blend: fix un-checked potential memory allocation failure X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Wu Jianhua Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: cY95R70j84UG Signed-off-by: Wu Jianhua --- libavfilter/vf_blend.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c index b6f3c4fed3..2d433e439f 100644 --- a/libavfilter/vf_blend.c +++ b/libavfilter/vf_blend.c @@ -279,7 +279,11 @@ static AVFrame *blend_frame(AVFilterContext *ctx, AVFrame *top_buf, dst_buf = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!dst_buf) return top_buf; - av_frame_copy_props(dst_buf, top_buf); + + if (av_frame_copy_props(dst_buf, top_buf) < 0) { + av_frame_free(&dst_buf); + return top_buf; + } for (plane = 0; plane < s->nb_planes; plane++) { int hsub = plane == 1 || plane == 2 ? s->hsub : 0;