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 0B2DC4232E for ; Mon, 11 Apr 2022 09:00:15 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 334F068B395; Mon, 11 Apr 2022 12:00:12 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DF2B868B181 for ; Mon, 11 Apr 2022 12:00:05 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 65C44240179 for ; Mon, 11 Apr 2022 11:00:05 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id n46d30wX6AZO for ; Mon, 11 Apr 2022 11:00:04 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 16D812400F5 for ; Mon, 11 Apr 2022 11:00:04 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 122A53A0631; Mon, 11 Apr 2022 10:49:36 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 11 Apr 2022 10:49:34 +0200 Message-Id: <20220411084934.8477-1-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220324230738.GW2829255@pb2> References: <20220324230738.GW2829255@pb2> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/snow: only allocate mconly_picture for decoding 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 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: It is not used in the encoder. --- Does this fix the crash? --- libavcodec/snow.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 0a500695ce..97b0448dbf 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -513,16 +513,20 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) { int ret, emu_buf_size; if(!s->scratchbuf) { - if ((ret = ff_get_buffer(s->avctx, s->mconly_picture, - AV_GET_BUFFER_FLAG_REF)) < 0) - return ret; + if (av_codec_is_decoder(avctx->codec)) { + if ((ret = ff_get_buffer(s->avctx, s->mconly_picture, + AV_GET_BUFFER_FLAG_REF)) < 0) + return ret; + } + emu_buf_size = FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * (2 * MB_SIZE + HTAPS_MAX - 1); if (!FF_ALLOCZ_TYPED_ARRAY(s->scratchbuf, FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * 7 * MB_SIZE) || !FF_ALLOCZ_TYPED_ARRAY(s->emu_edge_buffer, emu_buf_size)) return AVERROR(ENOMEM); } - if(s->mconly_picture->format != avctx->pix_fmt) { + if (av_codec_is_decoder(avctx->codec) && + s->mconly_picture->format != avctx->pix_fmt) { av_log(avctx, AV_LOG_ERROR, "pixel format changed\n"); return AVERROR_INVALIDDATA; } -- 2.34.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".