From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 41C054823B for ; Tue, 14 Nov 2023 18:23:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C8C6A68CD33; Tue, 14 Nov 2023 20:23:18 +0200 (EET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 02BA168C8A5 for ; Tue, 14 Nov 2023 20:23:10 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699986196; x=1731522196; h=from:to:cc:subject:date:message-id; bh=CoyNJo4g1slY7hqsZjimHwBQU85aExRZ91kl7xZ2IME=; b=YP5a6WtYJv3PeWbj1Ca7wQgHQkY/lRTknniMM7wd4ozGG52as7KBUPp9 UNNTcp+0onS/Yxj7HM2q4fhMUQ8INODYlYdOpqXsn3lQJ1KF1IV3xuFR3 gE9QkqEdkkHZ7gy5PvGEeXa0Td0OlvRYYjd5zGitiTDHTdg788mzgX/v7 9fPdvqGzp3jC95JkG5fqLrb/TjnB3c63WWA9CM4r4GbXD2DA6DJ6ann5C tg6qgIOxBNK1vLMIL9P++gZ7/zRsJPlUFioZnHnLNl68bpX1lEJEcExSE 5d1zP8L2k5ohnZIw1vGUp7y/gSGXYhl8WXOPgY1jviEfcj4rnyqWVokcF Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10894"; a="3826678" X-IronPort-AV: E=Sophos;i="6.03,302,1694761200"; d="scan'208";a="3826678" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2023 10:23:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10894"; a="714638377" X-IronPort-AV: E=Sophos;i="6.03,302,1694761200"; d="scan'208";a="714638377" Received: from dvrscl.jf.intel.com ([10.54.72.26]) by orsmga003.jf.intel.com with ESMTP; 14 Nov 2023 10:23:07 -0800 From: Dmitry Rogozhkin To: ffmpeg-devel@ffmpeg.org Date: Tue, 14 Nov 2023 10:22:31 -0800 Message-Id: <1699986151-24741-1-git-send-email-dmitry.v.rogozhkin@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH] avcodec/decode: guard against NULL hw_frames_ctx 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: Christoph Reiter , Dmitry Rogozhkin , Lynne MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Gurd against segfault running VLC decoding under msys2 [1]: Thread 33 received signal SIGSEGV, Segmentation fault. [Switching to Thread 37728.0xadd0] ff_hwaccel_frame_priv_alloc (avctx=0x6447b00, hwaccel_picture_private=0x65dfd00) at libavcodec/decode.c:1848 1848 frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data; (gdb) bt at libavcodec/decode.c:1848 at libavcodec/h264_slice.c:208 first_slice=1) at libavcodec/h264_slice.c:1599 at libavcodec/h264_slice.c:2130 at libavcodec/h264dec.c:652 got_frame=0x646e4b0, avpkt=0x64522c0) at libavcodec/h264dec.c:1048 (gdb) p avctx $1 = (AVCodecContext *) 0x6447b00 (gdb) p avctx->hw_frames_ctx $2 = (AVBufferRef *) 0x0 See[1]: https://github.com/msys2/MINGW-packages/pull/19050 Fixes: be07145109 ("avcodec: add AVHWAccel.free_frame_priv callback") CC: Lynne CC: Christoph Reiter Signed-off-by: Dmitry Rogozhkin --- libavcodec/decode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index ad39021..3caaeec 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1845,9 +1845,9 @@ int ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx, void **hwaccel_picture_pr av_assert0(!*hwaccel_picture_private); - frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data; + frames_ctx = (AVHWFramesContext *) avctx->hw_frames_ctx ? avctx->hw_frames_ctx->data : NULL; *hwaccel_picture_private = ff_refstruct_alloc_ext(hwaccel->frame_priv_data_size, 0, - frames_ctx->device_ctx, + frames_ctx ? frames_ctx->device_ctx : NULL, hwaccel->free_frame_priv); if (!*hwaccel_picture_private) return AVERROR(ENOMEM); -- 1.8.3.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".