From patchwork Mon Oct 24 03:16:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 38943 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp1997915pzb; Sun, 23 Oct 2022 20:18:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pq1DY5DG+JxrCVI6TrEnliNIcaJx0723+kkV8cE580CL1mPu1TCsYu0ieUdHvoB1Hkc2L X-Received: by 2002:a17:906:9b87:b0:733:1795:2855 with SMTP id dd7-20020a1709069b8700b0073317952855mr25757069ejc.156.1666581510361; Sun, 23 Oct 2022 20:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666581510; cv=none; d=google.com; s=arc-20160816; b=mB71Ag4QPGSiSUwDlasYy7swQTbfADzAudg6At/sZJIUzpR1HFk7dq2X2bl4zLZLOe HeHl+43BxeMvq9KlsyGscUAfqPsxD3/f8aWN55sJw606sDbcAXUrmvP9hZUJUUywnriK wEULMtonQHX4A2io/+VYJqDHt2Ur46ySje+KZES0dhagcXAbBb/uD54hvjmZoYOHbPO4 oyKr6Rlr4pPAQd9jFdNYzlCeMfSKQyBcmtXwGB4TKQCNWSeBxxRqqQWIcZReoPV4mgk+ FDxs0gjtNut0heIu44AY6+oJREYtbIzc9IRApZES1PP2bymsTay/wPXxpaIv5Eemj4lh bHsg== 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:date :to:from:message-id:dkim-signature:delivered-to; bh=jKXNZqlvVUqqHS5QaCk3t3jxteeySVCZYQzf+vQ7zSU=; b=bK0MV0GijUTGwpx3hJku/HPiQvU+bsxYypCPUcHk+8A4bBKNqNWOyw0cdcwYIF3veq KFWkhwOKx0WkKkhylu0O2dPeVoAsZyeDTBTK1THYIF5gxSAlC8dMe0Clv4ohnOh29BJI wak1ztxI9kvfWjWhh6I/TaKgS8aPnVCwWC4XEPjbNUkPHDpbvgfFOOW9qyJvrxljc0IW eFmItozW5M2qyFF3yokJ5wchzdN07RNu2+S+NPgpyMWeoI3o7I3iGRI1DD5+xsY2opLe jcZGgqElnDr2b2rpw68NDJkyOLLTgNhMUerPgDnQsl5IDcIQNJfwzfbrmIT4WoiyVnUB qpsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=Nf2+xS5f; 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 sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id rn25-20020a170906d93900b0076f061ffab4si21324850ejb.51.2022.10.23.20.18.30; Sun, 23 Oct 2022 20:18:30 -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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=Nf2+xS5f; 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 sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E9DBF68BD72; Mon, 24 Oct 2022 06:17:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-210.mail.qq.com (out203-205-221-210.mail.qq.com [203.205.221.210]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 62E6A68BD3D for ; Mon, 24 Oct 2022 06:17:27 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1666581445; bh=aWQzvDj42aZ9vae0EUxLYZ2w2w2+N1oUXwzJ0MHmBM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Nf2+xS5fXx6NO71OhueQw7DbBXRMmIgqOw8Mnfb2u/KhD9hMNenS7sXS4pLBA6FSG pXT9+QVMa/rts7esApT2blYsVKl54mfAqUBbh9TxDOJjeWwjZ4a9nZ880wyzU1H5Ru GtP0cLzYpdMnaI84fLxsEe2i/fGdgrldopBmVo74= Received: from localhost.localdomain ([59.37.125.102]) by newxmesmtplogicsvrsza31.qq.com (NewEsmtp) with SMTP id 44A14270; Mon, 24 Oct 2022 11:17:10 +0800 X-QQ-mid: xmsmtpt1666581443tj5b0980x Message-ID: X-QQ-XMAILINFO: NsLYjltVP0elw07cjmLNbburSJs6NkaJ+G0DiFnWbluwkuCgWNxcNI5UvFEbiL 8/wFLjb+hkfQ3PBrTEB8rJqojveDwynkKI1qmV9ropGswTHf1Y3MQVL5CU5HeuXhKAM4krPhh4m0 cafwiaAvhTWt+v41BxXld/DeCWSoX5WkXPMBhihuYdk12rF2cMzXnIs1CiuPs5OITSZGvBP0FZQR ft13GfD9Phd6W7ZVfNpk22lhH/6wA9OPWGqxZy6u0DghGagrI8hrj4Ldpv5AZH12A2+TMICOU0ai 3eP8BMWgWr5TeCL/SzXhTUyfVTIYyvDg6qHQ+Vaz3xmUYdLhnE6bzYxqzm9//CPYsb+rnfgHZ4n4 Tx7sWYKaDEsknEpHjvYoJboRDxpplTZag9lauzqK9Vp0I7G1SZdberAvaLj0s4us+/5jXPka9/sV bqY5ThnhpC1hJHUaL7o7Y5NwiLX8aeKKfOJ+M6qiz8pRTOyCG+Lc0Q11+8qIr7HmRwDyNbfzrlwy G6edkj5ACkG7dA/4d+ojuKBEO23e0xdTycpOW3OzZoIBEz3VymRMP5Qfc4n12Hf9zfhqWMSSMyZi OsN7sSXtpb+cY3UWOSLzlhYCuY8T7ZJsMI9F2fYwB491uXqLpitNoz2FUXbWL4FMVISA2UvJBhyN NrG24ntP5lGT7ckLiPMnmXMiUwL8PoTLEVeAus+Z3OYWfXHu4DagSaDKmTGzGeMMelCEqksrj0bd otrKgIESwjbNUHniqetRgfah6CdIvEz+71hwSJ2J4i+Gmw4Co4sJ3NzHR2f0WB+BFl925PKF67v/ i4M8qI1atkgRMLW9ynWjCG32IvFotXz6jcsoujBnYYtafdmfPC7UmlmTeHEHQ0TsZJbCEMHT/9LO 8YXPFXOCX8dvL1VA6NKgrkOhCN+RkfJKumwB3ln3QkK1xtxDfZhoOFeIIFzImrWAW8wROwAD/GWH 3kqQoTjwJcwe+BCydOW9AB0JY7BDDpvswimZi4LRkVHHWVhvvQxvZzNcb7CNMD From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Oct 2022 11:16:57 +0800 X-OQ-MSGID: <20221024031658.1026118-12-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024031658.1026118-1-quinkblack@foxmail.com> References: <20221024031658.1026118-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 11/12] avutil/hwcontext: verify hw_frames_ctx in transfer_data_alloc 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: matthieu.bouron@stupeflix.com, Zhao Zhili , aman@tmm1.net Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: PWINadfMmDUE From: Zhao Zhili --- libavutil/hwcontext.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index ab9ad3703e..3396598269 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -397,10 +397,14 @@ int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ref, static int transfer_data_alloc(AVFrame *dst, const AVFrame *src, int flags) { - AVHWFramesContext *ctx = (AVHWFramesContext*)src->hw_frames_ctx->data; + AVHWFramesContext *ctx; AVFrame *frame_tmp; int ret = 0; + if (!src->hw_frames_ctx) + return AVERROR(EINVAL); + ctx = (AVHWFramesContext*)src->hw_frames_ctx->data; + frame_tmp = av_frame_alloc(); if (!frame_tmp) return AVERROR(ENOMEM);